How to Roll Back Changes with Helm

How to Roll Back Changes with Helm

Helm is a powerful package manager for Kubernetes that enables you to deploy, manage, and upgrade complex applications with ease. However, sometimes things can go wrong during the deployment process, and you may need to roll back your changes to a previous state.

In this article, we will discuss how to roll back changes with Helm.

  1. Checking Release History

Before rolling back any changes with Helm, it is important to check the release history of your deployment. You can do this by running the following command:
$ helm history RELEASE_NAME

Replace RELEASE_NAME with the name of your release. This command will display a list of all revisions of the release, along with their status, date, and description.

  1. Rolling Back to a Previous Version

To roll back your deployment to a previous version, you can use the following command:
$ helm rollback RELEASE_NAME REVISION_NUMBER

Replace RELEASE_NAME with the name of your release, and REVISION_NUMBER with the number of the revision you want to roll back to. This command will revert your deployment to the previous state, as defined in the specified revision.

  1. Updating Values

If you need to update the values of your deployment before rolling back, you can use the following command:
$ helm upgrade --set key=value RELEASE_NAME CHART_NAME

Replace key=value with the values you want to update, RELEASE_NAME with the name of your release, and CHART_NAME with the name of the chart you want to deploy. This command will update the values of your deployment, and you can then roll back to a previous revision as described in step 2.

  1. Releasing a New Version

If you need to release a new version of your deployment with the changes rolled back, you can use the following command:
$ helm upgrade --reset-values RELEASE_NAME CHART_NAME

Replace RELEASE_NAME with the name of your release, and CHART_NAME with the name of the chart you want to deploy. This command will release a new version of your deployment with the values reset to their default values.

  1. More Examples

Here are some additional examples of rolling back changes with Helm:
  • To roll back to the previous revision of your deployment:

    $ helm rollback RELEASE_NAME

    This command will roll back your deployment to the previous revision.

  • To roll back to a specific revision of your deployment and update the values:

    $ helm upgrade --set key=value RELEASE_NAME CHART_NAME --recreate-pods
    $ helm rollback RELEASE_NAME REVISION_NUMBER

    Replace key=value with the values you want to update, RELEASE_NAME with the name of your release, CHART_NAME with the name of the chart you want to deploy, and REVISION_NUMBER with the number of the revision you want to roll back to. The --recreate-pods flag ensures that the pods are recreated with the updated values.

Related Searches and Questions asked:

  • How to Install Minikube on CentOS 8
  • List of kubectl Commands with Examples
  • How to Install Minikube on Ubuntu 22.04
  • How to Install Minikube on CentOS 7
  • That's it for this post. Keep practicing and have fun. Leave your comments if any.

    Post a Comment

    0 Comments