Forum Navigation
You need to log in to create posts and topics.

Error: services is forbidden: User "system:anonymous" cannot list resource "services" in API group "" in the namespace "default

Problem 

User gets the following error when running a kubectl commands

kubectl get pods
Please enter Username: root
Please enter Password: r***
Error from server (Forbidden): services is forbidden: User “system:anonymous” cannot list resource “services” in API group “” in the namespace “default

Solution 

Usually it happened because the user you are currently use to login to kubernetes does not have roles suitable to access cluster resources.

the user you are currently using is set in your homedir/.kube/config

check the section

users:
– name: kubernetes-admin
user:
client-certificate-data:

One option is to restore your original config file created upon installation the default user name is kubernetes-admin

Additional option is to set proper cluster roles to the specified user

 

If you have found my website, guides, articles or videos useful, please buy me a coffee