DEV Community

Wycliffe A. Onyango
Wycliffe A. Onyango

Posted on

100 Days of DevOps: Day 52

Rollback a Kubernetes Deployment

To resolve a bug in a recent release, the Nautilus DevOps team needed to revert their application to the previous, stable version. This process is known as a rollback. Kubernetes makes this straightforward with the kubectl rollout undo command.

Command and Output

The command used to initiate the rollback of the nginx-deployment was:

kubectl rollout undo deployment/nginx-deployment
Enter fullscreen mode Exit fullscreen mode

The successful execution of this command produced the following output:

deployment.apps/nginx-deployment rolled back
Enter fullscreen mode Exit fullscreen mode

Why the Command is Used

The kubectl rollout undo command is a powerful tool for managing application deployments. When a new version of a deployment is applied, Kubernetes stores a history of the changes. If an issue is discovered with the new version, this command tells Kubernetes to revert the deployment to the immediately preceding, successful revision from its history. It's a key part of a robust deployment strategy, allowing teams to quickly recover from faulty releases without needing to manually re-apply a previous configuration file.

Top comments (0)