Skip to content

Latest commit

 

History

History
executable file
·
59 lines (37 loc) · 1.74 KB

TASK_78-Rollback_deployment_in_Kubernetes.md

File metadata and controls

executable file
·
59 lines (37 loc) · 1.74 KB

Start:         2022-12-26 23:52:16
Finished:   2022-12-26 23:58:25



TASK 78: Rollback a Deployment in Kubernetes

Requirements

This morning the Nautilus DevOps team rolled out a new release for one of the applications. Recently one of the customers logged a complaint which seems to be about a bug related to the recent release. Therefore, the team wants to rollback the recent release.

There is a deployment named nginx-deployment; roll it back to the previous revision.

Note: The kubectl utility on jump_host has been configured to work with the kubernetes cluster.


Steps

Always check the running deployment and resources first before doing any changes.

~$ kubectl get deployment
NAME               READY   UP-TO-DATE   AVAILABLE   AGE
nginx-deployment   1/3     1            1           15s

~$ kubectl get pods
NAME                                READY   STATUS    RESTARTS   AGE
nginx-deployment-5946cc7684-68c5v   1/1     Running   0          12s
nginx-deployment-5946cc7684-h5kq2   1/1     Running   0          16s
nginx-deployment-5946cc7684-klk5j   1/1     Running   0          26s

To rollback to a previous realease, we can use the rollout undo command.

kubectl rollout undo deployment  nginx-deployment 

We can verify if the rollback was successful by using the rollout status command.

~$ kubectl rollout status deployment  nginx-deployment 

deployment "nginx-deployment" successfully rolled out

Resources