Task_05_Execute Rolling Updates in Kubernetes =>>Error from server (NotFound): pods "nginx-deployment" not found

Task:
An application currently running on the Kubernetes cluster employs the nginx web server. The Nautilus application development team has introduced some recent changes that need deployment. They’ve crafted an image nginx:1.18 with the latest updates.

Execute a rolling update for this application, integrating the nginx:1.18 image. The deployment is named nginx-deployment.

Ensure all pods are operational post-update.

Note: The kubectl utility on jump_host is set up to operate with the Kubernetes cluster

Solution:
Logged into the jumphost
did all the checks

Kubectl get deployments, pods…
pods are running fine.
I started rolling update, using kubectl set imgae … command,
Got an error message - error: unable to find container named “nginx”

I described the deployment and at the botttom, there is an error

Events:
Type Reason Age From Message


Normal Scheduled 3m15s default-scheduler Successfully assigned default/nginx-deployment-989f57c54-p6h8f to kodekloud-control-plane
Normal Pulling 3m14s kubelet Pulling image “nginx:1.16”
Normal Pulled 3m8s kubelet Successfully pulled image “nginx:1.16” in 6.401818134s (6.401913975s including waiting)
Normal Created 3m7s kubelet Created container nginx-container
Normal Started 3m7s kubelet Started container nginx-container
Error from server (NotFound): pods “nginx-deployment” not found

Can someone please check the error and fix the deployment, I am not able to do the rolling update tasks on this server.

Thanks

Your problem here is with the syntax of the kubectl set image command. The correct syntax is

kubectl set image KIND RESOURCE-NAME CONTAINER-NAME=NEW-IMAGE

So if you look at your input, the CONTAINER-NAME for that pod is actually nginx-container. So the correct invocation is

kubectl set image deploy nginx-deployment nginx-container=nginx:1.19

Thanks @rob_kodekloud for the correction. I made a note of the syntax explanation

It worked