search by tags

for the user

adventures into the land of the command line

how to use helm to rollback a release

oh noes!1 i accidentally deleted a deployment instead of a pod! damn it, how can i bring it back with helm, without having to redeploy it?

★ helm list
NAME                    REVISION    UPDATED                     STATUS      CHART                           NAMESPACE
monitoring              9           Tue Apr  3 17:59:56 2018    DEPLOYED    prometheus-5.5.1                monitoring

★ helm history monitoring
REVISION    UPDATED                     STATUS      CHART               DESCRIPTION
1           Mon Mar 26 17:51:00 2018    SUPERSEDED  prometheus-5.5.1    Install complete
2           Mon Mar 26 17:53:55 2018    SUPERSEDED  prometheus-5.5.1    Upgrade complete
3           Tue Apr  3 15:55:31 2018    SUPERSEDED  prometheus-5.5.1    Upgrade complete
4           Tue Apr  3 16:00:36 2018    SUPERSEDED  prometheus-5.5.1    Upgrade complete
5           Tue Apr  3 16:06:30 2018    SUPERSEDED  prometheus-5.5.1    Upgrade complete
6           Tue Apr  3 16:36:40 2018    SUPERSEDED  prometheus-5.5.1    Upgrade complete
7           Tue Apr  3 16:38:32 2018    SUPERSEDED  prometheus-5.5.1    Upgrade complete
8           Tue Apr  3 16:47:07 2018    SUPERSEDED  prometheus-5.5.1    Upgrade complete
9           Tue Apr  3 17:59:56 2018    DEPLOYED    prometheus-5.5.1    Upgrade complete

★ helm rollback monitoring 9
Rollback was a success! Happy Helming!

this only works, i believe, if you set your revisionHistoryLimit in your deployment to something greater than 0

spec:
  revisionHistoryLimit: 10

this value tells kubernetes how many replica sets to keep. by default, it keeps them all. if it is set to zero, then kubernetes removes the replica set for the previous deployment on the new deployment, and rolling back to the old deployment by using the old replica set means that helm will have to pull the old image again, sort of like a deployment. otherwise it will be like an instant rollback. at least i think thats how it works.

anyway, yay for helm rollback