kuberneteskubectl

Kubectl get nodes return "the server doesn't have a resource type "nodes""


I installed the Kubernetes and performed kubeadm init and join from the worker too. But when i run kubectl get nodes it gives the following response

the server doesn't have a resource type "nodes"

What might be the problem here? COuld not see anything in the /var/log/messages

Any hints here?


Solution

  • It looks to me that the authentication credentials were not set correctly. Did you copy the kubeconfig file /etc/kubernetes/admin.conf to ~/.kube/config? If you used kubeadm the API server should be configured to run on 6443, not in 8080. Could you also check that the KUBECONFIG variable is not set?

    It would also help to increase the verbose level using the flag --v=99. Moreover, are you accessing from the same machine where the Kubernetes master components are installed, or are you accessing from the outside?