Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error: unable to find container in kubectl set image

I am trying to push an update to my codebase for my docker image. I have the docker image on kubernetes on GCP and I followed the way it was mentioned in the document here. I even pushed the image with :v2 tag to the container registry and that image is visible in the console as well. But now when I am trying to run:

kubectl set image deployment/clustername myImageName=gcr.io/${PROJECT_ID}/myImageName:v2

it gives me the following error:

error: unable to find container myImageName

I know that the image is there because I build it with

docker build -t gcr.io/${PROJECT_ID}/myImageName:v2 .

I have also fixed the issue of: Error from server (NotFound): deployments.extensions I am stuck at this very moment. Can anyone throw some light on it?

like image 416
Siddharth Choudhary Avatar asked Sep 19 '19 20:09

Siddharth Choudhary


People also ask

What does Kubectl set image do?

The kubectl set image command updates the nginx image of the Deployment's Pods one at a time. You can use kubectl apply to update a resource by applying a new or updated configuration.

How do I fix image pull back off error?

To resolve it, double check the pod specification and ensure that the repository and image are specified correctly. If this still doesn't work, there may be a network issue preventing access to the container registry. Look in the describe pod text file to obtain the hostname of the Kubernetes node.

What is the meaning of ImagePullBackOff?

The status ImagePullBackOff means that a container could not start because Kubernetes could not pull a container image (for reasons such as invalid image name, or pulling from a private registry without imagePullSecret ).


1 Answers

The error message specifies that your deployment doesn't have a container named myImageName.

The syntax for kubectl set image is:

kubectl set image deployment-name container-name=image-name

container-name must be the name of a container you specified inside your deployment under spec.template.spec.containers.name.

like image 191
Alassane Ndiaye Avatar answered Sep 21 '22 04:09

Alassane Ndiaye