Error when running kubectl set image


Cluster information:

Kubernetes version:240
Cloud being used: gcloud
Installation method: gcloud sdk component
Host OS: win 10 home
CNI and version:
CRI and version:

I have a Jenkins pipeline where I run a batch file as a post-build action.
The command kubectl set image deployment/gpy gpy=%IMAGE_NAME% returns an error:the server doesn’t have a resource type deployment".
Interestingly this works fine if I run the batch file outside of Jenkins.

Help please



I ran into a similar thing also, specifically using the google cloud build.

I want to mention that you may want to verify your namespace and make sure you are passing that

something like this:
kubectl set image deployment/your-app-staging --namespace staging

I received the error: Error from server (NotFound): deployments.extensions “my-app-staging” not found

However when I ran the EXACT command locally (literally, cut and paste from the log) it worked fine.

I am thinking of opening a ticket against their cloud build.



What is the kubectl context?

If you run kubectl get pods or kubectl get nodes, does it connect to your cluster? Is your config file okay?



Thank you for taking the time to respond - will try that



Thank you for taking the time to respond. Yes - kubectl get nodes or pods connects to my google cloud cluster and retrieves the correct information.



And can you elaborate on the error?

Does the deployment show anything new if you kubectl describe deployment ?

And if you run kubectl with more verbose output? Does it show anything interesting?