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?
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.
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.
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 ).
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With