'kubectl get namespace' command "namespaces is forbidden" error

4/19/2019

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,

enter image description here

How can I resolve this issue?

-- Jacob
kubectl
kubernetes

1 Answer

4/19/2019

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

-- Vasily Angapov
Source: StackOverflow