Skip to content
Tutorials Center
My learning

Topics

Lesson 38 of 38 ยท Projects and Practice

Helm Practice: Exercises, Checklists and Interview Questions

Practice Helm with hands-on exercises on dependencies, hooks, OCI, testing and CI, a chart review checklist, common failures and interview questions with answers.

Reading about Helm gets you halfway. The other half is the muscle memory of rendering, diffing and recovering. This final lesson gives you exercises that build that memory, a checklist for reviewing any chart, a table of the failures you will meet most often, and interview questions with short model answers. The exercises use a local kind or minikube cluster for the real commands, and Python stand-ins here to check your reasoning.

Part 1: Exercises

Try each one before reading the hint.

1. Dependencies. Create a chart blog that depends on postgresql (^16.0.0) with a condition. Run helm dependency update, then helm dependency build in a fresh clone. What changes if you edit the range and only run build?

Hint: build refuses when the lock digest no longer matches Chart.yaml.

2. Globals. Set global.imageRegistry in the parent and make a subchart prepend it to its image. What happens if the subchart sets its own global.imageRegistry?

Hint: the parent's value wins.

3. Hooks. Add a pre-upgrade Job with weight -5 that prints "backup" and a post-upgrade Job that prints "smoke". Upgrade twice. Why does the second upgrade fail if you forgot before-hook-creation?

4. Rollbacks. Install a release, upgrade it twice, then helm rollback to revision 1. How many revisions are in helm history afterwards, and which has status deployed?

Answer: four; the newest, with the description "Rollback to 1".

5. OCI. Run a local registry (docker run -p 5000:5000 registry:2), then helm push a package with --plain-http-style flags as needed and install it back by oci://localhost:5000/.... Why is there no helm search repo for it?

6. Schema. Write a values.schema.json that rejects replicaCount: 0 and an unknown top-level key typo. Prove it with helm lint.

7. Tests. Write three helm-unittest cases: default replicas, an if branch for ingress, and a failedTemplate for a missing required value.

8. CI. Write a workflow that fails a pull request when a chart changes and its version does not.

The stand-in below checks your answer to exercise 4 by simulating revisions, so you can predict the output before running the real commands.

Python Exercise check: revisions after upgrades and a rollback

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Part 2: A chart review checklist

Use this list when reviewing someone else's chart, or your own before release.

Structure

  • Chart.yaml has apiVersion: v2, a SemVer version, a quoted appVersion, a description and maintainers.
  • .helmignore excludes CI files and fixtures; Chart.lock is committed when there are dependencies.

Templates

  • All names come from helpers and are truncated to 63 characters.
  • Selector labels are stable and separate from other labels.
  • Every optional object sits behind an if on a documented value.
  • toYaml plus nindent is used for blocks; no hand-indented values.
  • Pods roll when config changes (checksum annotation).

Values

  • Every value is documented in values.yaml and constrained by values.schema.json.
  • Secrets are never defaulted; an existingSecret option exists.
  • Image tags are pinned, defaulting to appVersion, never latest.

Safety

  • Non-root, no privilege escalation, read-only root filesystem where possible, resource requests and limits.
  • RBAC is namespace-scoped and has no wildcards.
  • CRDs are handled intentionally (separate chart or documented step).

Operations

  • Hooks are idempotent with a delete policy and deadlines.
  • A test hook exists; helm lint --strict, unit tests and a schema validator run in CI.
  • Upgrades from the previous version are tested; release notes explain breaking changes.
Python Exercise: score a chart against the checklist

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Part 3: Failures you will meet

Message or symptom Likely cause Fix
nil pointer evaluating interface {}.x Missing value or map Add a default in values.yaml, or guard with with/default
YAML parse error ... did not find expected key Bad indentation from indent vs nindent Render with helm template and inspect
found in Chart.yaml, but missing in charts/ Dependencies not downloaded helm dependency build
another operation is in progress Interrupted release helm history, then helm rollback
field is immutable Changed selector or Job template Recreate the object; keep selectors stable
already exists for a hook Job No delete policy Add before-hook-creation
Config change did not restart Pods No checksum annotation Add checksum/config
Values vanished after upgrade --set without -f, no reuse flag Pass full values or --reset-then-reuse-values
unauthorized on pull/push Registry login expired helm registry login
CRDs not updated Helm never upgrades crds/ Apply CRDs separately

Part 4: Interview questions

What is the difference between a chart, a release and a repository? A chart is a package of templates and defaults. A release is one installed instance of a chart in a cluster, with a name and a history of revisions. A repository is a place that serves packaged charts.

What changed between Helm 2 and Helm 3? Tiller (the in-cluster server) was removed, so Helm uses the caller's own Kubernetes permissions; releases are stored as Secrets in the release's namespace; three-way merges replaced two-way; charts got apiVersion: v2 with dependencies in Chart.yaml; OCI support arrived later.

How do values override each other? Chart values.yaml defaults, then parent chart values for a subchart, then -f files in order, then --set flags. Maps merge deeply; lists are replaced wholesale.

How do you run a database migration safely? In a pre-upgrade hook Job with a delete policy, a deadline and a backward-compatible, idempotent migration, so rollbacks and retries are safe.

How do you keep secrets out of Git? Reference existing Secrets, use an external secrets operator or SOPS/sealed secrets, and never default passwords in values.yaml. Remember release records are readable.

Helm or Kustomize? Helm packages and distributes configurable applications with versioning. Kustomize patches plain YAML without templates. They combine well: render with Helm, then patch with a post-renderer or Kustomize.

How would you roll out a risky change? helm diff, upgrade with --atomic --wait, health checks and a canary controller if traffic shifting is needed, and a tested rollback.

Python Exercise: lists replace, maps merge

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The result keeps tls (a map key merged) but the host list is replaced, not appended. This is the most surprising merge rule for newcomers: to add a host you must repeat the full list.

Where to go next

  • Build a chart for an application you already run and publish it to an OCI registry.
  • Read the source of a popular chart's _helpers.tpl and values.schema.json and note which patterns you can reuse.
  • Combine Helm with a GitOps controller on a test cluster and practise promotion and rollback through Git.
  • Explore the other tracks on this site: Docker, Terraform and CI/CD with GitHub Actions pair naturally with Helm.

Check your understanding

Quick check ยท 3 questions

of 3 answered You scored / 3 ยท perfect!

  1. 1. After an install, two upgrades and a rollback to revision 1, how many revisions does helm history show?

    Rollback appends a new revision; history is never rewritten.
  2. 2. How are lists treated when values are merged?

    Maps merge by key but lists and scalars are replaced entirely.
  3. 3. Which is NOT a reason to prefer a pre-upgrade hook for migrations?

    Rollback restores Kubernetes objects, not your data, so migrations must be backward compatible.

Summary

  • Practise render, diff, upgrade, rollback and recovery on a throwaway cluster until they are routine.
  • Review charts with a checklist covering structure, templates, values, safety and operations.
  • Know the common failures and their fixes, and the value-merge rules (maps merge, lists replace).
  • You now have the full Helm picture: charts, templates, dependencies, hooks, registries, testing, security and delivery.

Next: Back to the Helm tutorial