简体   繁体   中英

'kubectl get namespace' command “namespaces is forbidden” error

When I am using kubectl get namespace command in my Kubernetes master node, I am getting proper output. And also I configured kubectl in my local machine. When I am running the same command from local machine configured with kubectl, I am getting error like the following,

Error from server (Forbidden): namespaces is forbidden: User "system:node:mildevkub020" cannot list resource "namespaces" in API group "" at the cluster scope

I copied the configuration file kubelet.conf from cluster and copied into .kube/config. And also installed the kubectl. This is the process what did till now.

Result of kubectl config view is like the following,

在此处输入图片说明

How can I resolve this issue?

Kubespray by default saves cluster admin kubeconfig file as inventory/mycluster/artifacts/admin.conf. Read more here: https://github.com/kubernetes-sigs/kubespray/blob/master/docs/getting-started.md#accessing-kubernetes-api

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM