CodeBlanks Logo Icon CodeBlanks

helm upgrade

Learn to upgrade a release with helm upgrade.

helm upgrade

helm upgrade moves a release to a new chart version or new values; each upgrade creates a new revision. --install installs the release if it doesn't exist; that's why in CI pipelines upgrade --install is used as a single command:

helm upgrade --install magaza ./magaza -n magaza -f prod-values.yaml --set image.tag=1.4.3 --wait
helm history magaza -n magaza
REVISION  STATUS      CHART         APP VERSION  DESCRIPTION
1         superseded  magaza-0.1.0  1.4.2        Install complete
2         deployed    magaza-0.1.0  1.4.2        Upgrade complete

Rolling back and uninstalling

If an upgrade causes problems, helm rollback returns the release to an earlier revision. --atomic rolls back a failed upgrade automatically. helm uninstall deletes all of the release's resources (PVCs usually remain):

helm rollback magaza 1 -n magaza
helm upgrade magaza ./magaza --atomic --timeout 5m
helm uninstall magaza -n magaza

Practice CI deployment and rollback

Write three commands: upgrade ./magaza as the magaza release in the magaza namespace, installing it if missing, with prod-values.yaml, --set image.tag=1.4.3 and --atomic; show the release history; roll back to revision 1.

Starter code

terminal
# buraya yaz

Sample solution

terminal
helm upgrade --install magaza ./magaza -n magaza -f prod-values.yaml --set image.tag=1.4.3 --atomic
helm history magaza -n magaza
helm rollback magaza 1 -n magaza

Expected output

Release "magaza" has been upgraded. Happy Helming!
REVISION  STATUS      CHART         APP VERSION  DESCRIPTION
1         superseded  magaza-0.1.0  1.4.2        Install complete
2         deployed    magaza-0.1.0  1.4.2        Upgrade complete
Rollback was a success! Happy Helming!

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 During helm upgrade, what happens to values not given with --set?

  • All are kept
  • The release is deleted
  • It errors
  • They return to chart defaults; the previous install's --set values aren't kept by themselves Correct answer

Explanation: --reuse-values keeps the previous values; but keeping all values in a file is safest.

2 Install the release if missing, otherwise upgrade it.

Question
helm upgrade ____ magaza ./magaza
Answer
helm upgrade --install magaza ./magaza

Explanation: upgrade --install is an idempotent deploy command.

3 Match.

Term Meaning
upgrade --install Install or upgrade
helm history Revisions
helm rollback Return to an earlier revision
--atomic Roll back on failure

All lessons in Advanced