Determine what resource was not found from "Error from server (NotFound): the server could not find the requested resource"

Glen Pierce picture Glen Pierce · Jul 4, 2018 · Viewed 19k times · Source

I'm running kubectl create -f notRelevantToThisQuestion.yml

The response I get is:

Error from server (NotFound): the server could not find the requested resource

Is there any way to determine which resource was requested that was not found?

kubectl get ns returns

NAME STATUS AGE
default Active 243d
kube-public Active 243d
kube-system Active 243d

This is not a cron job.
Client version 1.9
Server version 1.6

This is very similar to https://devops.stackexchange.com/questions/2956/how-do-i-get-kubernetes-to-work-when-i-get-an-error-the-server-could-not-find-t?rq=1 but my k8s cluster has been deployed correctly (everything's been working for almost a year, I'm adding a new pod now).

Answer

sobi3ch picture sobi3ch · May 17, 2019

To solve this, downgrade the client or upgrade the server. In my case I've upgraded server (new minikube) but forget to upgrade client (kubectl) and end up with those versions.

$ kubectl version --short
Client Version: v1.9.0
Server Version: v1.14.1

When I'd upgraded client version (in this case to 1.14.2) then everything started to work again.

Instructions how to install (in your case upgrade) client are here https://kubernetes.io/docs/tasks/tools/install-kubectl