Kubernetes "the server doesn't have a resource type deployments" Kubernetes "the server doesn't have a resource type deployments" kubernetes kubernetes

Kubernetes "the server doesn't have a resource type deployments"


The first step would be to increase a verbosity level to help in finding out the root cause:

Kubectl get deployments --v=99

Overall, there few things that might cause it:

  1. You might have run commands below as a root user, not a regular one. So run as a regular user

cp -i /etc/kubernetes/admin.conf $HOME/.kube/config

chown $(id -u):$(id -g) $HOME/.kube/config

As suggested here https://github.com/kubernetes/kubernetes/issues/52636

  1. Certificates in kubectl config file expired or if the cluster is in "AWS EKS" then IAM access keys might be inactive.

In my case when running "kubectl get deployments --v=99" in addition to “the server doesn't have a resource type deployments” it showed that:

Response Body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"Unauthorized","reason":"Unauthorized","code":401

If it is the case then check out your certificates kubectl config file (they might not be there, expired, new ones have to be created, etc) or if on EKS then IAM keys issued/activated.

  1. Lack of RBAC permissions so that a user/group for whom certificates/keys issued/signed are not allowed to view specific resources.


please change user to root and try the same. It worked for me


I was experiencing exactly the same behavior as in "Edit 1" above with Kubernetes 1.13.5 (client and server). Removing the ~/.kube/http-cache directory on the client worked for me.