Helm is a package manager for Kubernetes that makes it easier to deploy applications and services, including rolling updates. Helm also lets you perform a rollback to a previous version of your application.
In this tutorial, we will cover different ways you can roll back changes using Helm.
- Access to the terminal/command line
- A Kubernetes cluster installed
- An installation of Helm
How to Roll Back to the Previous Release in Helm
Helm uses the
rollback command to return to a previous revision:
1. Use the
ls command to find the name of the current Helm release:
In this case, the option
-A lists releases across all namespaces:
2. Use the
history command to find the current revision number:
helm history [release]
3. Roll back to a previous release by using the
helm rollback command. The rollback command uses the following syntax:
helm rollback [release] [revision] [flag]
[release]: The release name you want to roll back to.
[revision]: The revision number you want to roll back to.
[flag]: Optional command flags, such as
For example, to roll back to the WordPress release 1, revision 1, enter:
helm rollback wordpress-01 1
Note: Omitting the revision number rolls the application back to the previous release. Learn how to get Helm values from old releases.
How to Roll Back Using kubectl
rollout undo command allows you to roll back your deployment using
kubectl rollout undo deployment/[release]
To roll back to a specific revision, use:
kubectl rollout undo deployment/[release] --to-revision=[revision]
Note: Performing a rollback using
kubectl will only roll back the deployment, without affecting other resources associated with the Helm release. Additionally, you can use
kubectl to delete an unwanted copy of Helm deployment and namespace.
After following this tutorial, you should be able to roll back changes in Helm using the
rollback command and
Also, check out our guide to managing Helm repositories, or take a look at Kubernetes and all it can do.