Use a local kind or minikube cluster with Helm 3.17+ (Helm 4 works too; rename --atomic to --rollback-on-failure if you want to avoid deprecation warnings). Install the diff plugin once with helm plugin install https://github.com/databus23/helm-diff. Keep every chart you write in a Git repository: several later assignments build on earlier ones. Open a hint only after you have tried for 10 minutes.
Beginner
A1. Install a public chart and read what it did ๐ข
Objective: Get comfortable with the basic release workflow against a real chart.
Tasks
- Add the Bitnami repository (or use
oci://registry-1.docker.io/bitnamicharts/nginxdirectly) and runhelm search repo nginx --versions | head. - Run
helm show chart,helm show valuesandhelm show readmefor the nginx chart and note the chartversionandappVersion. - Install it as release
webin a new namespaceweb-labwith a pinned--version. - List the release, show its status, and list every Kubernetes object it created.
- Print the rendered manifest Helm stored for the release.
Expected outcome: helm list -n web-lab shows web as deployed, revision 1, and you can explain the difference between the chart version and the app version from the show chart output.
Hints
helm install web bitnami/nginx -n web-lab --create-namespace --version <x.y.z>. helm status web -n web-lab, helm get manifest web -n web-lab, and kubectl get all -n web-lab -l app.kubernetes.io/instance=web. Always pin --version; without it you get whatever is latest today.
Bonus: Install the same chart a second time as web2 in the same namespace and explain why two releases of one chart do not collide.
A2. Override values three ways ๐ข
Objective: Learn values precedence by observing it, not memorizing it.
Tasks
- Save the default values of the nginx chart from A1 to
defaults.yaml. - Create
small.yamlsettingreplicaCount: 2and the Service type toClusterIP. - Create
big.yamlsettingreplicaCount: 4. - Upgrade
webwith-f small.yaml -f big.yaml --set replicaCount=3and predict the result before running it. - Compare
helm get values webwithhelm get values web --all.
Expected outcome: The Deployment runs 3 replicas, and you can state the order: chart defaults < -f files left to right < --set. You can explain why get values without --all only shows the user-supplied values.
Hints
helm show values bitnami/nginx > defaults.yaml. Check the result with kubectl get deploy -n web-lab. Then drop the --set and rerun to see big.yaml win over small.yaml.
Bonus: Set an annotation value of "true" with --set and then with --set-string, and show which one Kubernetes rejects and why.
A3. Upgrade, history and rollback ๐ข
Objective: Practice the release lifecycle and read the history like an on-call engineer.
Tasks
- Make three upgrades of
web, each changing one value (replicas, a resource limit, an extra label). - Run
helm history web -n web-laband describe each revision's status. - Roll back to revision 2.
- Run
helm historyagain and explain the new revision number. - Use
helm get values web --revision 2and--revision 4to prove the rollback restored revision 2's values.
Expected outcome: History shows revisions 1 to 5, with revision 5 described as Rollback to 2, and its values match revision 2.
Hints
helm rollback web 2 -n web-lab --wait. Rollback creates a new revision with old content; it never deletes or rewrites history.
Bonus: Add --history-max 3 to an upgrade and count the release Secrets before and after.
A4. Find and decode the release Secret ๐ข
Objective: Understand where Helm 3 keeps its state.
Tasks
- List the Secrets in
web-labthat belong to Helm, showing theirstatusandversionlabels. - Decode the current revision's Secret and print the release status, chart version and the first 20 lines of the manifest.
- Explain the two layers of base64 and the gzip.
- In a throwaway namespace, install a chart, delete all its release Secrets, and run
helm list. - Show that the workloads are still running.
Expected outcome: You can pull any field out of a release Secret with one pipeline, and you can explain why deleting the Secrets makes Helm forget the release without touching the workloads.
Hints
kubectl get secret -n web-lab -l owner=helm -L status,version. Decode with kubectl get secret sh.helm.release.v1.web.v3 -n web-lab -o jsonpath='{.data.release}' | base64 -d | base64 -d | gunzip | jq '.info.status, .chart.metadata.version'.
Bonus: Explain what HELM_DRIVER=configmap changes and why Secrets are the default.
A5. Scaffold a chart and explain every file ๐ข
Objective: Know the chart anatomy well enough to defend each file in an interview.
Tasks
- Run
helm create helloand list the tree. - Write one sentence for each file and folder on what it does and when it is used.
- Change the image to
nginxinc/nginx-unprivilegedwith tag1.27-alpineand the container port to 8080. - Delete the files you do not need (for example
hpa.yaml,ingress.yaml,serviceaccount.yaml) and fix any template that referenced them. - Install it, port-forward to it and get a 200.
Expected outcome: A minimal working chart with a Deployment and a Service, installed and reachable, plus your file-by-file notes.
Hints
Check values.yaml for serviceAccount.create and ingress.enabled references left in other templates, and NOTES.txt, which references the Ingress and Service type. helm lint hello tells you what broke after deleting files.
Bonus: Add a .helmignore rule and prove with helm package plus tar -tzf that the file is excluded.
A6. Render offline and lint ๐ข
Objective: Use the tools that catch mistakes before a cluster ever sees them.
Tasks
- Render your
hellochart withhelm templateand save the output. - Render only the Deployment with
-s templates/deployment.yaml. - Break the chart three ways (a missing
{{ end }}, a wrong indentation, a reference to a value that does not exist) and record each error fromhelm lintandhelm template. - Run
helm lint --strictand explain which extra issues it reports. - Compare
helm templatewithhelm install --dry-run=server.
Expected outcome: A short table of the three errors with their exact messages and fixes, and a one-line explanation of when to use template vs --dry-run=server.
Hints
A missing value does not fail by default; it renders as empty or <no value>. --strict turns lint warnings into failures. --dry-run=server contacts the API server, so it validates against real API versions and lets lookup return data.
Bonus: Pipe helm template into kubeconform -strict -summary and make it pass.
A7. Chart version vs appVersion ๐ข
Objective: Version charts correctly.
Tasks
- Set
version: 0.1.0andappVersion: "1.27.0"inhello/Chart.yaml. - Make the image tag default to
.Chart.AppVersionwhenimage.tagis empty. - Make a template-only change and decide which version to bump.
- Ship a new app version and decide which versions to bump.
- Package each version and show the archive names.
Expected outcome: hello-0.1.0.tgz, hello-0.1.1.tgz (template fix) and hello-0.2.0.tgz (new app), with helm show chart reflecting the right appVersion in each.
Hints
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}". helm package hello --version 0.1.1 --app-version 1.27.0 can override both at package time, which is how CI usually does it.
Bonus: Explain why appVersion should be quoted in Chart.yaml.
A8. NOTES.txt that helps the person who just installed ๐ข
Objective: Write useful post-install output with conditionals.
Tasks
- Write a
NOTES.txtthat prints the release name, namespace, chart version and revision. - Print a
kubectl port-forwardcommand when the Service type isClusterIP. - Print the external IP lookup command when the type is
LoadBalancer. - Print the Ingress URL when
ingress.enabledis true. - Re-display the notes later without reinstalling.
Expected outcome: Installing with different values prints different, copy-pasteable instructions, and helm get notes shows them again.
Hints
Use {{ .Release.Name }}, {{ .Release.Namespace }}, {{ .Chart.Version }}, {{ .Release.Revision }}, and {{- if eq .Values.service.type "LoadBalancer" }}. helm get notes <release>.
Bonus: Make NOTES.txt print a warning when replicaCount is 1.
A9. Repositories and searching ๐ข
Objective: Work with classic HTTP chart repositories confidently.
Tasks
- Add two repositories (for example
prometheus-communityandingress-nginx). - Update the repo cache and search both for a chart with
--versions. - Pull a chart archive with a pinned version and untar it.
- Remove one repository and show that installs from it now fail.
- Explain what
index.yamlis and where Helm caches it.
Expected outcome: You can add, update, search, pull and remove repos, and you can show the cached index.yaml files on disk.
Hints
helm repo add, helm repo update, helm search repo ingress-nginx/ingress-nginx --versions, helm pull ingress-nginx/ingress-nginx --version <v> --untar. The cache lives under helm env HELM_REPOSITORY_CACHE.
Bonus: Build your own HTTP repo: helm package, helm repo index . --url http://localhost:8000, serve it with python3 -m http.server 8000, add it and install from it.
A10. Uninstall cleanly ๐ข
Objective: Know exactly what helm uninstall removes and what it leaves behind.
Tasks
- Install a chart that creates a StatefulSet with
volumeClaimTemplates(for example a database chart). - Add a resource with the annotation
helm.sh/resource-policy: keepto yourhellochart and install it. - Uninstall both releases.
- List what is left in each namespace.
- Uninstall another release with
--keep-historyand show it inhelm list -a.
Expected outcome: You can name three things that survive helm uninstall (PVCs from StatefulSets, resource-policy: keep resources, hook resources) and the cleanup command for each.
Hints
kubectl get pvc,cm,secret -n <ns> after uninstalling. helm list -n <ns> -a (or --uninstalled) shows releases kept with --keep-history.
Bonus: Use helm uninstall --wait and explain what it waits for.
Intermediate
A11. Helpers for names and labels ๐ก
Objective: Build the naming and labelling foundation every good chart has.
Tasks
- In
_helpers.tpl, define<chart>.name,<chart>.fullname,<chart>.chart,<chart>.labelsand<chart>.selectorLabels. - Make
fullnamerespectfullnameOverride, usenameOverride, avoid repeating the chart name if the release name contains it, and truncate to 63 characters. - Use the helpers in the Deployment, Service and every other template.
- Keep only stable labels in
spec.selector. - Install releases named
hello,hello-devandteam-aand show the resulting resource names.
Expected outcome: Names are hello, hello-dev and team-a-hello; every object carries the recommended app.kubernetes.io/* labels; selectors contain only name and instance.
Hints
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} and {{- if contains $name .Release.Name }}. Use include (not template) so you can pipe into nindent. Prefix every helper name with the chart name because names are global across subcharts.
Bonus: Upgrade a release after changing a selector label and capture the field is immutable error.
A12. Lists, maps and context: range, with, $ ๐ก
Objective: Master the template constructs behind most rendering bugs.
Tasks
- Add
envas a map in values and render it as a list ofname/valuepairs withrange $k, $v. - Add
extraVolumesandextraVolumeMountsas lists rendered withtoYaml | nindent. - Use
withfor optional blocks (nodeSelector,tolerations,podAnnotations) so empty values render nothing. - Inside a
withblock, reference.Release.Namecorrectly. - Render with and without each value set and diff the output.
Expected outcome: No empty keys like nodeSelector: with nothing under them, no <no value> strings, and correct indentation in every combination.
Hints
Inside with and range, . changes; use $.Release.Name. {{- with .Values.nodeSelector }} then nodeSelector: then {{- toYaml . | nindent 8 }} then {{- end }}. Quote env values with | quote.
Bonus: Sort the env map keys explicitly and explain whether range over a map is already ordered in Helm.
A13. Guardrails: required, fail and values.schema.json ๐ก
Objective: Make bad values fail fast with clear messages.
Tasks
- Make
image.repositoryrequired with a custom message usingrequired. - Use
failto rejectautoscaling.minReplicas > autoscaling.maxReplicas. - Write
values.schema.jsonthat enforcesreplicaCountas an integer of at least 1,service.typeas an enum, andimagewith no unknown keys. - Make
database.passwordrequired only whendatabase.enabledis true, usingif/then. - Trigger each guardrail and capture the error.
Expected outcome: Five distinct, readable errors, all raised by helm template before anything reaches a cluster.
Hints
{{ required "image.repository is required" .Values.image.repository }}. In the schema use "additionalProperties": false on image, and "if": {"properties": {"enabled": {"const": true}}}, "then": {"required": ["password"]}. Do not set additionalProperties: false at the root if you have subcharts or global.
Bonus: Explain why the schema rejects --set replicaCount=two but a required check would not catch a wrong type.
A14. Subchart dependency with alias, condition and globals ๐ก
Objective: Compose charts the way platform teams do.
Tasks
- Add a Redis or PostgreSQL chart as a dependency of
hellowith a pinned version range. - Give it an
aliasand acondition, and configure it from the parent'svalues.yaml. - Add
global.imageRegistryand use it in both the parent and your own local subchart. - Run
helm dependency update, commitChart.lock, and rebuild from a clean clone withhelm dependency build. - Install with the dependency enabled, then upgrade with it disabled and an external host configured.
Expected outcome: Resources named with the alias, the dependency toggled cleanly by its condition, and a reproducible build from Chart.lock.
Hints
In Chart.yaml: dependencies: - name: postgresql, version: "16.x.x", repository: "oci://registry-1.docker.io/bitnamicharts", alias: db, condition: db.enabled. Values for the subchart go under db:. A subchart sees .Values.global but never the parent's other values.
Bonus: Use import-values to pull a value from the subchart up into the parent.
A15. A migration hook with weights and delete policies ๐ก
Objective: Run a one-off task at the right moment of a release.
Tasks
- Write a Job that runs a SQL or shell migration, annotated as a
pre-upgradehook. - Ship the migration script in a ConfigMap that is also a hook with a lower weight.
- Set a delete policy that recreates the Job on the next run and keeps it when it fails.
- Make the Job fail on purpose and observe what Helm reports and what remains in the cluster.
- Explain why
pre-installwould be the wrong hook if the database is part of the same release.
Expected outcome: The ConfigMap is created before the Job, a successful Job is cleaned up, a failed Job remains for kubectl logs, and the upgrade fails when the Job fails.
Hints
"helm.sh/hook": pre-upgrade, "helm.sh/hook-weight": "-5" (weights are strings, sorted ascending), "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded. Set backoffLimit and activeDeadlineSeconds so a broken Job does not retry forever. Non-hook ConfigMaps still hold the old content during pre-upgrade.
Bonus: Explain what helm uninstall does with hook resources and clean them up.
A16. helm test that actually tests something ๐ก
Objective: Add post-deploy verification that runs in the cluster.
Tasks
- Write two test Pods under
templates/tests/: one checks the Service responds, one checks a dependency (database, cache) through the app. - Order them with hook weights.
- Run
helm testwith--logsafter an install. - Break the app (wrong port in the Service) and run the tests again.
- Use
--filterto run only one test.
Expected outcome: Both tests pass on a healthy release, the right one fails on a broken one, and the failure output tells you which hop is broken.
Hints
Annotate with "helm.sh/hook": test. Use restartPolicy: Never and an image with curl (curlimages/curl). helm test <release> --logs --filter name=<pod-name>.
Bonus: Wire helm test into a CI job so a failing test triggers helm rollback.
A17. Safe CI deploys with diff and atomic upgrades ๐ก
Objective: Build the deploy step a production pipeline uses.
Tasks
- Write a script that runs
helm lint --strict,helm template | kubeconform, thenhelm diff upgradefor a release. - Deploy with
helm upgrade --install --atomic --wait --timeout 5m --history-max 10. - Deploy a broken image tag and confirm the automatic rollback.
- Make the script exit non-zero on any failure and print
helm historyon failure. - Run it in GitHub Actions (or any CI) against a kind cluster.
Expected outcome: A green run for a good change, a red run with an automatic rollback for a bad one, and the diff visible in the job log before the upgrade happens.
Hints
set -euo pipefail. helm diff upgrade <rel> <chart> -n <ns> -f values.yaml --detailed-exitcode exits 2 when there are changes. Kind in CI: helm/kind-action. Do not use --reuse-values in CI; pass the full values every time.
Bonus: Post the diff as a pull-request comment.
A18. Publish to an OCI registry ๐ก
Objective: Distribute charts the modern way.
Tasks
- Run a local
registry:2(or use GHCR / ECR). - Package
helloat two versions and push both. - Show the chart in the registry (tag list or console).
- Install and upgrade from
oci://with--version. - Use an OCI chart as a dependency in another chart's
Chart.yaml.
Expected outcome: Both versions listed in the registry, a release installed from OCI and upgraded between them, and a parent chart resolving an OCI dependency.
Hints
helm push hello-0.1.0.tgz oci://localhost:5001/charts --plain-http. For a dependency: repository: "oci://localhost:5001/charts" (no chart name in the URL). There is no helm repo add for OCI; log in with helm registry login for private registries.
Bonus: Sign the pushed artifact with cosign and verify it before install.
A19. One chart, three environments ๐ก
Objective: Structure environment configuration so differences are obvious in review.
Tasks
- Create
values-dev.yaml,values-staging.yamlandvalues-prod.yamloutside the chart, containing only overrides. - Enable HPA and PDB only in prod; disable
replicasin the Deployment when HPA is on. - Render all three and produce a diff between staging and prod.
- Install dev and staging as separate releases in separate namespaces.
- Add a values-file layering example:
values-common.yaml+values-prod.yaml.
Expected outcome: Each environment file is short, helm template for prod contains HPA and PDB while dev does not, and two releases of the same chart run side by side.
Hints
{{- if not .Values.autoscaling.enabled }} replicas: ... {{- end }}. Diff rendered output with diff <(helm template ... -f staging) <(helm template ... -f prod). Lists replace rather than merge across values files, so prefer maps for things environments extend.
Bonus: Put the three releases in a helmfile.yaml with environments and run helmfile diff.
A20. Config rollouts with checksums and tpl ๐ก
Objective: Make config changes roll pods, and render templated values.
Tasks
- Add a ConfigMap with app config generated from values.
- Add a
checksum/configannotation to the pod template so a config change rolls the Deployment. - Add a value
extraConfigthat contains template expressions (for example{{ .Release.Name }}) and render it withtpl. - Change only the config and upgrade; confirm pods restarted.
- Upgrade with no changes and confirm pods did not restart.
Expected outcome: Config changes trigger a rollout, no-op upgrades do not, and tpl renders release-specific strings from values.
Hints
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}. {{ tpl .Values.extraConfig . }}; tpl needs the context as its second argument. Watch with kubectl rollout history.
Bonus: Explain why randAlphaNum or now in a template makes every upgrade roll the pods, and how lookup can keep a generated password stable.
Advanced
A21. A library chart shared by two services ๐ด
Objective: Remove copy-paste between application charts.
Tasks
- Create
common-libwithtype: librarycontaining helpers for names, labels, a Deployment and a Service. - Make the Deployment template accept overrides through a values contract (image, port, probes, resources, env).
- Build two application charts (
orders,payments) whose templates are one-lineincludecalls. - Version the library, push it to OCI and consume it as a dependency.
- Change a label in the library, bump its version, and roll it out to both charts.
Expected outcome: Two application charts with almost no templates of their own, rendering correct and distinct resources, and a library change propagated by bumping one dependency version.
Hints
A library chart cannot be installed and its templates are never rendered on their own. Define templates like {{- define "common-lib.deployment" -}} and call them as {{ include "common-lib.deployment" . }}. A common trick is a merge-based override pattern: the app chart passes its own partial template that the library merges into the base.
Bonus: Add unit tests for the library with the helm-unittest plugin.
A22. Recover stuck and orphaned releases ๐ด
Objective: Fix the two classic production Helm incidents without losing history.
Tasks
- Start an upgrade with a long
--timeoutand kill the Helm process withkill -9to leave the release inpending-upgrade. - Reproduce
another operation (install/upgrade/rollback) is in progress. - Recover with
helm rollback, and separately (in another attempt) by removing only the pending revision Secret. - Create a Service with
kubectl, then try to install a chart that renders the same Service. - Adopt the existing Service into the release using the ownership label and annotations.
Expected outcome: A written runbook for both incidents with the exact commands, and a release history that remains intact after recovery.
Hints
kubectl get secret -l owner=helm,status=pending-upgrade -n <ns>. Adoption needs app.kubernetes.io/managed-by=Helm, meta.helm.sh/release-name=<release> and meta.helm.sh/release-namespace=<ns>. kill -9 is what leaves the release pending; a graceful Ctrl-C may let Helm record the failure.
Bonus: Write a CI step that detects a pending release before deploying and fails with a clear message instead of hanging.
A23. Helmfile plus helm-secrets for a whole platform ๐ด
Objective: Manage many releases and environments declaratively with secrets in Git.
Tasks
- Write a
helmfile.yamlwith three releases (ingress-nginx, your app, a database) anddevandprodenvironments. - Use
needsto order the releases. - Encrypt prod secrets with SOPS and age, and reference them from Helmfile via helm-secrets.
- Run
helmfile diffandhelmfile applyfor dev, then prod. - Show that the decrypted values never land on disk in plain text in the repo and are not visible in
git diff.
Expected outcome: One command converges each environment, secrets are encrypted at rest in Git, and helmfile diff shows only real changes.
Hints
.sops.yaml with creation_rules and an age recipient; sops -e -i secrets.prod.yaml. In Helmfile, reference encrypted files under secrets: for a release. Install the plugin with helm plugin install https://github.com/jkroepke/helm-secrets.
Bonus: Replace age with AWS KMS and restrict decrypt permissions to the CI role.
A24. Your chart under Argo CD ๐ด
Objective: Understand what changes when Helm is only the renderer.
Tasks
- Deploy your chart (from Git or OCI) with an Argo CD
Applicationusinghelm.valueFilesandhelm.parameters. - Confirm the release is missing from
helm listand explain why. - Observe how your
pre-upgradeandpost-installhooks are mapped to Argo CD phases, and when each runs. - Find one template that behaves differently under Argo CD (
lookup,randAlphaNum,.Release.IsUpgrade) and fix it. - Convert the migration hook to native Argo CD hooks and sync waves.
Expected outcome: The chart syncs cleanly without permanent OutOfSync drift, hooks run at the intended moment, and you can explain each behavioral difference.
Hints
Argo CD runs the equivalent of helm template and applies the result itself. pre-install/pre-upgrade map to PreSync, post-install/post-upgrade to PostSync, and they run on every sync. lookup returns empty during rendering, and random functions produce a new value every render, which causes perpetual diffs.
Bonus: Use an ApplicationSet to deploy the chart to dev and prod with different value files.
A25. Survive a Kubernetes API removal ๐ด
Objective: Upgrade a release whose stored manifest uses APIs the cluster no longer serves.
Tasks
- Explain why a release that was installed with a removed API version (for example
policy/v1beta1PodDisruptionBudget) cannot be upgraded even after the chart is fixed. - On an older kind cluster, install a chart using a deprecated API, then upgrade the cluster to a version that removed it (or simulate by editing a stored release in a test namespace).
- Use the mapkubeapis plugin to rewrite the stored release manifest.
- Upgrade the release with the fixed chart.
- Add a CI check that fails when a rendered chart uses deprecated or removed APIs.
Expected outcome: The release upgrades successfully after the mapping, history is preserved, and CI catches the next deprecated API before it reaches a cluster.
Hints
Helm diffs the new manifest against the one stored in the last release Secret; if that stored manifest references a kind the API server no longer knows, the upgrade fails with unable to build kubernetes objects from current release manifest ... no matches for kind. helm plugin install https://github.com/helm/helm-mapkubeapis, then helm mapkubeapis <release> -n <ns> --dry-run first. For CI, pluto detect-helm or kubeconform with a target -kubernetes-version.
Bonus: Use .Capabilities.APIVersions.Has to make the chart support both old and new API versions during a migration window.