Introduction
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.
Prerequisites
- 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:
helm ls
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]
Where:
[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--dry-run
or--force
.
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
The rollout undo
command allows you to roll back your deployment using kubectl
:
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.
Conclusion
After following this tutorial, you should be able to roll back changes in Helm using the rollback
command and kubectl
.
Also, check out our guide to managing Helm repositories, or take a look at Kubernetes and all it can do.
Next you should also read
DevOps and Development,Virtualization
How to Add, Update or Remove Helm Repositories
December 21, 2020
Helm is Kubernetes' equivalent to apt and yum. It is a package manager used for deploying applications, which…
DevOps and Development,Virtualization
How to Install Helm on Ubuntu, Mac and Windows
December 10, 2020
Helm is a package manager for Kubernetes that simplifies deployment process. Follow this step-by-step…
SysAdmin,DevOps and Development,Virtualization
19 Kubernetes Best Practices for Building Efficient Clusters
September 23, 2020
Kubernetes is a feature-rich orchestration tool. The best practices outlined in this article are going to…
DevOps and Development,Virtualization
How to Restart Kubernetes Pods
August 27, 2020
Kubernetes is one of the premier systems for managing containerized applications. But it isn't always able to…
Author
Aleksandar Kovačević
Aleksandar Kovacevic is an aspiring Technical Writer at phoenixNAP. With a background in both design and writing, he aims to bring a fresh perspective to writing for IT, making complicated concepts easy to understand and approach.