Helm: install, upgrade, roll back
Install an app from a Helm chart at a fixed version, then upgrade it, roll it back and remove it.
Key ideas in this lesson · tap one for a simple explanation
What you will be able to do
- Add a chart repository, list a chart's versions and read its default values.
- Install a fixed chart version into a namespace with your own values, then upgrade it and roll it back.
- Find a release in any namespace, read its history and its values, and uninstall it.
installs apps on Kubernetes the way apt or brew installs programs on a computer. One command creates every object an app needs: its , , and more. Many cluster add-ons ship this way, such as ingress controllers and monitoring tools.
On the exam, a Helm task names everything you need: the repository, , chart version, release name, and values. The grader checks every one. The helm.sh docs are allowed in the exam, but helm <command> --help is faster: it lists every flag with an example.
Four words: chart, repository, release, revision
Chart + your values
Chart
the package
podinfo/podinfo
Values
your settings
replicaCount=2
helm install
fills the templates and applies them
Release web
the installed copy
Revision 1
install
Revision 2
upgrade
Revision 3
rollback
Helm fills the chart's templates with your values and applies the result. Each change to the release is saved as a new numbered revision.
- A chart has two version numbers. The chart version is the package's own version, and
--versionpicks it. The app version is the version of the software inside. On the exam, "version" means the chart version. - Helm is a program on your computer. Nothing of Helm runs in the cluster: it uses your , just like . Build your lab installs it.
- Helm keeps each release's history in the release's namespace. That is why most Helm commands need the same
-nyou installed with.
Read a chart before you install it
Before you install, add the repository and check which chart versions exist. Then look up the exact names of the values you need to set.
helm repo add podinfo https://stefanprodan.github.io/podinfo
helm repo update # refresh every index (or: helm repo update podinfo)
helm repo list
helm search repo podinfo # newest chart version only
helm search repo podinfo/podinfo --versions | head # every chart version with its app version
helm show chart podinfo/podinfo --version 6.14.0
helm show values podinfo/podinfo --version 6.14.0 > /tmp/cka/podinfo-values.yaml # every key and its default
# Render locally: no release is created and nothing reaches the cluster
helm template web podinfo/podinfo --version 6.14.0 -n arx-demo --set replicaCount=3 > /tmp/cka/web.yaml
grep -nE 'replicas:|image:' /tmp/cka/web.yamlInstall and inspect a release
helm install web podinfo/podinfo --version 6.14.0 \
-n arx-demo --create-namespace \
--set replicaCount=2 --set ui.message="hello" \
--wait --timeout 5m
helm list -n arx-demo # NAME, REVISION, STATUS, CHART (<name>-<chart version>), APP VERSION
helm list -A # every namespace; plain "helm list" shows the current namespace only
helm status web -n arx-demo
helm get values web -n arx-demo # only the values you supplied
helm get values web -n arx-demo --all # merged with the chart defaults
helm get manifest web -n arx-demo | grep -n 'kind:'Upgrade, roll back, uninstall
An upgrade changes a release in place and adds a revision. Two habits save points. Repeat --version, or Helm moves to the newest chart. Add --reuse-values to keep the values you set before; without it, an upgrade with new --set values forgets the old ones.
# Upgrade. Repeat --version, or Helm moves you to the newest chart in the repo.
helm upgrade web podinfo/podinfo --version 6.14.0 -n arx-demo \
--reuse-values --set replicaCount=3 --wait --timeout 5m
# Install if it is missing, upgrade it if it exists, with values from a file
helm upgrade --install web podinfo/podinfo --version 6.14.0 -n arx-demo -f /tmp/cka/web-values.yaml
helm history web -n arx-demo
helm rollback web 1 -n arx-demo --wait --timeout 5m # writes a NEW revision with revision 1's content
helm uninstall web -n arx-demo # deletes the objects and the release historyA rollback never deletes revisions. helm rollback web 1 copies revision 1 into a new revision. So after an install, an upgrade and a rollback, helm history shows three revisions.
In the official docs· open on exam day too
- Installing Helmsearch: installing helm
- Using Helmsearch: using helm
- helm upgradesearch: helm upgrade
- helm rollbacksearch: helm rollback
Install a pinned chart, upgrade it, roll it back
https://stefanprodan.github.io/podinfo (add it as podinfo): first, install a release named web of chart podinfo/podinfo, chart version 6.14.0, into namespace arx-helm (create the namespace) with replicaCount set to 2. Next, upgrade web so it runs 4 replicas and shows the UI message release two (value ui.message), keeping chart version 6.14.0. Finally, the message was not approved: roll web back to its first revision. The release must end with exactly three revisions and the Deployment must run 2 replicas.Cluster:kubectl config use-context kind-cka
- 1
Set up the scenario
curl -fsSL https://codewithmuh.com/labs/cka/t/ar-helm-1/setup | bash - 2
Solve it in your terminal
Use kubectl and the Kubernetes docs, like on exam day. Save any answer files under
/tmp/cka/. - 3
Check your work
curl -fsSL https://codewithmuh.com/labs/cka/t/ar-helm-1/verify | bashGot FAIL? Read which check failed, fix it, run it again. - 4
Clean up (optional)
curl -fsSL https://codewithmuh.com/labs/cka/t/ar-helm-1/cleanup | bash
Audit releases: remove the failed one, save the values of another
failed state. Write its namespace and name as <namespace>/<name> to /tmp/cka/helm/failed-release.txt, then uninstall it. Next, save the values that were supplied when release catalog in namespace arx-helm-audit was installed (only the user-supplied values, not the chart defaults) to /tmp/cka/helm/catalog-values.yaml. Do not change catalog.Cluster:kubectl config use-context kind-cka
- 1
Set up the scenario
curl -fsSL https://codewithmuh.com/labs/cka/t/ar-helm-2/setup | bash - 2
Solve it in your terminal
Use kubectl and the Kubernetes docs, like on exam day. Save any answer files under
/tmp/cka/. - 3
Check your work
curl -fsSL https://codewithmuh.com/labs/cka/t/ar-helm-2/verify | bashGot FAIL? Read which check failed, fix it, run it again. - 4
Clean up (optional)
curl -fsSL https://codewithmuh.com/labs/cka/t/ar-helm-2/cleanup | bash
Finished this lesson?
0 of 2 tasks passed. Your readiness counts tasks, so run them before you move on.