Rollback an upgrade using helm

helm upgrade rollback

3 min read | by Jordi Prats

When we upgrade an application using helm it can always go something wrong so instead of upgrading to another version or uninstall / install the application, we can rollback to a previous version that we know it is working

Previously we already talked about the helm history command

$ helm history pet2cattle
REVISION  UPDATED                   STATUS      CHART           APP VERSION DESCRIPTION     
60        Wed Dec 30 16:17:58 2020  superseded  pet2cattle-1.7  2.8         Upgrade complete
61        Fri Jan  1 21:45:07 2021  superseded  pet2cattle-2    3           Upgrade complete
62        Sat Jan  2 11:57:26 2021  superseded  pet2cattle-2    3.1         Upgrade complete
63        Sat Jan  2 22:09:24 2021  superseded  pet2cattle-2    3.2         Upgrade complete
64        Mon Jan  4 09:33:53 2021  superseded  pet2cattle-2    3.3         Upgrade complete
65        Tue Jan  5 07:57:53 2021  superseded  pet2cattle-2    3.4         Upgrade complete
66        Wed Jan  6 15:25:30 2021  superseded  pet2cattle-2    3.5         Upgrade complete
67        Thu Jan  7 09:10:07 2021  superseded  pet2cattle-2    3.6         Upgrade complete
68        Fri Jan  8 08:17:56 2021  superseded  pet2cattle-2    3.7         Upgrade complete
69        Sat Jan  9 19:23:25 2021  deployed    pet2cattle-2    3.8         Upgrade complete

Let's assume that the latest deployed versions is not working.

We can always rollback to it's previous versions by using the helm rollback command:

$ helm rollback pet2cattle
Rollback was a success! Happy Helming!

If we check again the helm history we will be able to see that it creates another revision with the previous app version

$ helm history pet2cattle
REVISION  UPDATED                   STATUS      CHART           APP VERSION DESCRIPTION     
60        Wed Dec 30 16:17:58 2020  superseded  pet2cattle-1.7  2.8         Upgrade complete
61        Fri Jan  1 21:45:07 2021  superseded  pet2cattle-2    3           Upgrade complete
62        Sat Jan  2 11:57:26 2021  superseded  pet2cattle-2    3.1         Upgrade complete
63        Sat Jan  2 22:09:24 2021  superseded  pet2cattle-2    3.2         Upgrade complete
64        Mon Jan  4 09:33:53 2021  superseded  pet2cattle-2    3.3         Upgrade complete
65        Tue Jan  5 07:57:53 2021  superseded  pet2cattle-2    3.4         Upgrade complete
66        Wed Jan  6 15:25:30 2021  superseded  pet2cattle-2    3.5         Upgrade complete
67        Thu Jan  7 09:10:07 2021  superseded  pet2cattle-2    3.6         Upgrade complete
68        Fri Jan  8 08:17:56 2021  superseded  pet2cattle-2    3.7         Upgrade complete
69        Sat Jan  9 19:23:25 2021  deployed    pet2cattle-2    3.8         Upgrade complete
70        Sat Jan  9 19:29:23 2021  deployed    pet2cattle-2    3.7         Rollback to 68  

Instead of rolling back to the previous revision we can also set to which revision we want to rollback:

$ helm rollback pet2cattle 61
Rollback was a success! Happy Helming!

Posted on 18/01/2021

Categories