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:v2it gives me the following error:
error: unable to find container myImageNameI 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?
Your command is wrong you have to remove the myImageName before the image url and pass the command
kubectl set image <deployment name> gcr.io/${PROJECT_ID}/myImageName:v2The documentation on the GCP hello-app tutorial has the syntax wrong. It should be:
kubectl set image deployment/clustername
clustername=gcr.io/${PROJECT_ID}/myImageName:v2rather than:
kubectl set image deployment/clustername
myImageName=gcr.io/${PROJECT_ID}/myImageName:v2The 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-namecontainer-name must be the name of a container you specified inside your deployment under spec.template.spec.containers.name.
check 'myImageName' container name is matching in the pod description.
Try command : kubectl describe pods
In pod description check the following under 'Containers' section: In the below example 'avroconsumerclient' is the name of the container.
Containers:
avroconsumerclient:
Container ID: docker://ab5890be34dfk5678dfdf5670ac19583d8859427695a258d4fdfd
Image: ************/democlient:v2
Image ID: docker-pullable://********/democlient@sha256:71e97df533915d62c433c2c04168bb7b1dd545c7ef423169a1452ac5abd4302e
Port: <none>
Host Port: <none>
State: Running