Error when running kubectl set image

#1

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

0 Likes

#2

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 your-app-staging=gcr.io/YourProjectId/your-staging:1-1-1 --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.

0 Likes

#3

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?

0 Likes

#4

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

0 Likes

#5

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.

0 Likes

#6

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?

0 Likes