Friday, 3 October 2025

Perform a Rolling Update in Kubernetes (nginx:1.17)

  Our course you can check :-   Udemy course


Ques:- 

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

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

Ensure all pods are operational post-update


Ans:-

raj@jumphost ~$ kubectl get deploy 

NAME               READY   UP-TO-DATE   AVAILABLE   AGE

nginx-deployment   3/3     3            3           7m58s


raj@jumphost ~$ kubectl get pod

NAME                               READY   STATUS    RESTARTS   AGE

nginx-deployment-989f57c54-dkrzv   1/1     Running   0          12m

nginx-deployment-989f57c54-rhbjw   1/1     Running   0          12m

nginx-deployment-989f57c54-rkjwh   1/1     Running   0          12m


raj@jumphost ~$ kubectl get deploy nginx-deployment -oyaml | grep -i image:

      - image: nginx:1.16



raj@jumphost ~$ kubectl get deploy nginx-deployment -oyaml | grep -i name:

  name: nginx-deployment

      name: nginx-replica

        name: nginx-container

      schedulerName: default-scheduler

raj@jumphost ~$ 


raj@jumphost ~$ kubectl set image deployment/nginx-deployment nginx-container=nginx:1.17

deployment.apps/nginx-deployment image updated


raj@jumphost ~$ kubectl rollout status deployment/nginx-deployment

deployment "nginx-deployment" successfully rolled out


raj@jumphost ~$ kubectl get deploy nginx-deployment -oyaml | grep -i image:

      - image: nginx:1.17

raj@jumphost ~$ 


raj@jumphost ~$ kubectl get deploy nginx-deployment

NAME               READY   UP-TO-DATE   AVAILABLE   AGE

nginx-deployment   3/3     3            3           22m


raj@jumphost ~$ kubectl get pod

NAME                                READY   STATUS    RESTARTS   AGE

nginx-deployment-5dd558cf95-h26qs   1/1     Running   0          7m25s

nginx-deployment-5dd558cf95-qhtmt   1/1     Running   0          7m26s

nginx-deployment-5dd558cf95-qm56h   1/1     Running   0          7m31s

raj@jumphost ~$ 

No comments:

Post a Comment