KCNA Helm and Package Management 3 — Questions and Answers
Question 1: What is a Helm 'hook' and when is it executed?
- A plugin that intercepts all Helm CLI commands
- An annotation-driven Kubernetes resource executed at specific points in a release lifecycle (Correct answer)
- A webhook registered in the Kubernetes API server for Helm events
- A Go function embedded in a chart's values.yaml
Correct answer: An annotation-driven Kubernetes resource executed at specific points in a release lifecycle
Helm hooks are Kubernetes manifests annotated with `helm.sh/hook` that run at lifecycle points such as pre-install, post-install, pre-upgrade, or pre-delete.
Question 2: Which `helm` subcommand displays the values currently applied to a deployed release?
- helm show values
- helm get values (Correct answer)
- helm inspect values
- helm describe values
Correct answer: helm get values
`helm get values <release>` retrieves the user-supplied values for a running release; adding `--all` also shows computed defaults.
Question 3: What is the effect of setting `helm.sh/hook-delete-policy: before-hook-creation` on a hook resource?
- Prevents the hook from being deleted after completion
- Deletes the previous hook resource before creating a new one on the next run (Correct answer)
- Skips hook execution if the resource already exists
- Deletes the hook resource before the release is installed
Correct answer: Deletes the previous hook resource before creating a new one on the next run
The `before-hook-creation` policy tells Helm to delete the existing hook resource before creating a fresh one, preventing conflicts on re-runs.
Question 4: Which file in a Helm chart directory contains metadata such as the chart name, version, and description?
- values.yaml
- Chart.yaml (Correct answer)
- requirements.yaml
- NOTES.txt
Correct answer: Chart.yaml
`Chart.yaml` is the mandatory metadata file that declares the chart's name, version, type, description, and other top-level properties.
Question 5: When using `helm upgrade --install`, what happens if the specified release does not yet exist?
- The command fails with an error requiring `helm install` first
- Helm performs an initial installation instead of an upgrade (Correct answer)
- Helm creates a blank release with no resources
- Helm prompts the user to confirm installation
Correct answer: Helm performs an initial installation instead of an upgrade
`--install` makes `helm upgrade` idempotent: if the release doesn't exist it is installed; if it does, it is upgraded.
Question 6: What does the Helm function `tpl` allow you to do inside templates?
- Import external YAML files into the chart
- Render a string as a Helm template, enabling dynamic values (Correct answer)
- Convert a template to a reusable named block
- Validate template syntax without deploying
Correct answer: Render a string as a Helm template, enabling dynamic values
The `tpl` function processes a string value as a Go template, which lets values in values.yaml themselves contain template expressions.
Question 7: Which Helm repository command refreshes the locally cached list of charts from all added repositories?
- helm repo sync
- helm repo update (Correct answer)
- helm repo refresh
- helm repo fetch
Correct answer: helm repo update
`helm repo update` fetches the latest `index.yaml` from every configured repository and updates the local cache so new chart versions are discoverable.
What is a Helm 'hook' and when is it executed?