Helm rollback to previous release
Asked Answered
W

7

55

I am looking for a way to rollback a helm release to its previous release without specifying the target release version as a number.

Something like helm rollback <RELEASE> ~1 (like git reset HEAD~1) would be nice.

Windshield answered 17/8, 2018 at 11:20 Comment(0)
U
39

Unlike the previous old answers above.

According to the latest documentation, you can rollback to the previous version by simply omitting the argument in helm rollback. Which means your command should like below to rollback to the previous version.

helm rollback <RELEASE_NAME>

But if you need to rollback to specific previous version, You can:

First: List revision numbers by running helm history <RELEASE_NAME>

Second: Roll back to the version you want using helm rollback <RELEASE> [REVISION]

Ukulele answered 20/9, 2020 at 17:21 Comment(0)
W
64

As it turns out, there is an undocumented option to rollback to the previous release by defining the target release version as 0. like: helm rollback <RELEASE> 0

Source: https://github.com/helm/helm/issues/1796

Windshield answered 17/8, 2018 at 11:28 Comment(3)
this command seems to rollback to previous revision regardless of it being successful or not.Singleton
The official doc says: The first argument of the rollback command is the name of a release, and the second is a revision (version) number. If this argument is omitted, it will roll back to the previous release. The 0 is no long required. helm.sh/docs/helm/helm_rollbackJuliennejuliet
"Error: release: not found"Romero
U
39

Unlike the previous old answers above.

According to the latest documentation, you can rollback to the previous version by simply omitting the argument in helm rollback. Which means your command should like below to rollback to the previous version.

helm rollback <RELEASE_NAME>

But if you need to rollback to specific previous version, You can:

First: List revision numbers by running helm history <RELEASE_NAME>

Second: Roll back to the version you want using helm rollback <RELEASE> [REVISION]

Ukulele answered 20/9, 2020 at 17:21 Comment(0)
L
19

If you just want to rollback to the previous release, you can do

helm rollback <RELEASE> 0
Lapp answered 17/8, 2018 at 11:30 Comment(0)
U
13

Using Helm

helm rollback release-name 0

Using kubectl

What does rollout/rollback in kubectl means? Rolling updates allow the following actions:

  1. Promote an application from one environment to another (via container image updates).
  2. Rollback to previous versions.
  3. Continuous Integration and Continuous Delivery of applications with zero downtime.

kubectl rollout undo deployment/deployment-name

or

kubectl rollout undo deployment/deployment-name --to-revision=0

Uncomfortable answered 2/1, 2020 at 5:26 Comment(2)
Please note that kubectl this way will rollback only the deployment, but not other resources associated with helm release.Enlarger
@aleksandr erokhin yes that's absolutely true, because kubectl maintains only the Deployment object and helm maintains the release which contains all the manifest/objects altogether. I have updated the answer however the above was just a way to provide how does it work in kubectl.Uncomfortable
C
8

Below are the steps you can rollback Using Helm:

  1. Check the name of a release and (version) number using $ helm ls
  2. The first argument of the rollback command is the name of a release, and the second is a revision (version) number.
$ helm rollback RELEASE [REVISION]
Crabbed answered 7/9, 2020 at 19:11 Comment(0)
A
0

You can simply do -

helm rollback <release-name> <release version> -n <namespace>

In helm3 namespace is required, whereas in lower version, you can do below -

helm rollback <release-name> <release version>
Anton answered 18/2, 2022 at 5:45 Comment(0)
U
0

I can add a couple of steps that always help.

  1. Use helm -n namespace list to get all releases, in case you don't have the whole name, you can even filter if needed helm -n integration list | grep text-to-filter-by
  2. Check the revision list for the release helm -n namespace history release-name. You will get [REVISION, UPDATED, STATUS, CHART, APP VERSION, DESCRIPTION]
  3. Rollback to specific revision helm -n namespace rollback release-name REVISION
Unitarianism answered 30/5 at 21:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.