Day 07 Rollback Deployment

Day 07 Rollback Deployment

A developer-friendly rollback :).

Introduction:

Previously we did deployments with various container images, Rollback in Kubernetes is a life server in case of reverting the deployed code.

Rollback can be done for either previous or specific the version of deployment.

(1) Rollback Deployment to the previous version.

# we can list deployment versions using below command.
kubectl rollout history deployment/nginx-deployment

# Rollback to previous version
kubectl rollout undo deployment/nginx-deployment

# Verify the rollbacked deployment.
kubectl get deployment
kubectl describe deployment/nginx-deployment
  • Once you found that the rollback is completed you can check with URL.

(2) Rollback to a Specific Version.

# we can list deployment versions using below command.
kubectl rollout history deployment/nginx-deployment

# assign specific version value to --to-revision=#n
kubectl rollout undo deployment/nginx-deployment --to-revision=5

(3) Restart the deployment in a rolling fashion.

In case you have to re-deploy the same deployment you can use this feature.

kubectl rollout restart deployment/nginx-deployment

Made with :heart by Pratikkumar Panchal