Kubernetes Container Orchestration Helm and Package Management 4 — Questions and Answers
Question 1: What is the purpose of Helm hooks?
- They allow external webhooks to trigger Helm deployments
- They execute Kubernetes jobs or other resources at specific points in the release lifecycle (Correct answer)
- They define health check endpoints for deployed services
- They register event listeners for Kubernetes resource changes
Correct answer: They execute Kubernetes jobs or other resources at specific points in the release lifecycle
Helm hooks use annotations like `helm.sh/hook: pre-install` to run Jobs or other resources before/after install, upgrade, or delete.
Question 2: What happens to hook resources after they complete by default?
- They are immediately deleted
- They remain in the cluster and must be manually cleaned up or use hook-delete-policy (Correct answer)
- They are moved to a completed namespace
- They are converted to ConfigMaps for auditing
Correct answer: They remain in the cluster and must be manually cleaned up or use hook-delete-policy
Hook resources persist after completion unless a `helm.sh/hook-delete-policy` annotation specifies `before-hook-creation` or `hook-succeeded`.
Question 3: How do you rollback a Helm release to the previous revision?
- helm revert myapp
- helm rollback myapp (Correct answer)
- helm undo myapp
- helm restore myapp 0
Correct answer: helm rollback myapp
`helm rollback <release>` rolls back to the previous revision; specify a revision number like `helm rollback myapp 2` for a specific version.
Question 4: Which Helm command packages a chart directory into a versioned `.tgz` archive?
- helm build ./mychart
- helm package ./mychart (Correct answer)
- helm archive ./mychart
- helm compress ./mychart
Correct answer: helm package ./mychart
`helm package` creates a `.tgz` file named `<chart>-<version>.tgz` suitable for distribution via a chart repository.
Question 5: What is an OCI-based Helm chart registry?
- A Helm repository that uses OAuth for authentication
- A registry using the OCI (Open Container Initiative) standard to store charts as container artifacts (Correct answer)
- A chart repository optimized for offline/air-gapped environments
- A Helm plugin for integrating with container scanning tools
Correct answer: A registry using the OCI (Open Container Initiative) standard to store charts as container artifacts
Helm 3.8+ supports storing and pulling charts from OCI-compliant registries like Docker Hub, ECR, and GCR using `helm push` and `helm pull oci://`.
Question 6: What does setting `--atomic` flag do during `helm upgrade`?
- Applies all changes in a single Kubernetes transaction
- Automatically rolls back the release if the upgrade fails (Correct answer)
- Prevents concurrent upgrades to the same release
- Skips pre-upgrade hooks to speed up deployment
Correct answer: Automatically rolls back the release if the upgrade fails
`--atomic` causes Helm to automatically rollback to the previous release if any part of the upgrade fails or times out.
Question 7: In a Helm chart, what is the `.helmignore` file used for?
- Specifying values that cannot be overridden by users
- Listing files and patterns to exclude when packaging the chart (Correct answer)
- Defining linting rules for CI/CD validation
- Marking deprecated chart features for future removal
Correct answer: Listing files and patterns to exclude when packaging the chart
`.helmignore` works like `.gitignore`, preventing specified files (tests, CI configs, READMEs) from being included in the packaged chart.
What is the purpose of Helm hooks?