Stage 5 · Platform
Release Packaging with Helm & Kustomize
Helm Release Operations
install, upgrade, rollback, history, atomic releases, and failed hook cleanup.
Install Operations
Helm install creates a release — a named installation of a chart. It renders templates, validates against the cluster, and applies resources. Use --wait to wait for all resources to be ready before returning.
# Basic install
helm install my-release ./my-chart -n production
# Install with values file
helm install my-release ./my-chart -n production -f values-prod.yaml
# Install with set overrides
helm install my-release ./my-chart -n production --set replicaCount=5
# Install and wait for readiness
helm install my-release ./my-chart -n production --wait --timeout 5m
# Dry run — validate without installing
helm install my-release ./my-chart --dry-run --debug
# Create namespace if not exists
helm install my-release ./my-chart -n production --create-namespace
# Install from OCI registry
helm install my-release oci://ghcr.io/my-org/charts/my-chart --version 1.0.0--wait blocks until all resources are ready or timeout. --timeout sets the maximum wait time. --dry-run renders templates without applying. --debug shows rendered manifests for inspection.
Upgrade Operations
Helm upgrade updates an existing release. It compares old and new manifests, shows a diff, and applies changes. Use --reuse-values to keep previous values for unspecified keys.
# Upgrade with new values
helm upgrade my-release ./my-chart -n production -f values-prod-v2.yaml
# Upgrade and reuse previous values
helm upgrade my-release ./my-chart -n production --reuse-values --set image.tag=2.0.0
# Upgrade with timeout
helm upgrade my-release ./my-chart -n production --wait --timeout 10m
# Show diff before upgrading
helm diff upgrade my-release ./my-chart -f values-prod-v2.yaml
# Force upgrade (re-create resources)
helm upgrade my-release ./my-chart -n production --force
# Upgrade and create namespace
helm upgrade my-release ./my-chart -n production --create-namespace--reuse-values merges new values with previous ones. --force deletes and recreates resources (use with caution). helm diff shows what will change before upgrading. Always test upgrades in staging first.
Rollback Operations
Helm rollback reverts a release to a previous revision. Each upgrade/rollback creates a new revision. Rollback is instant — it applies the previous manifest set.
# Rollback to previous revision
helm rollback my-release -n production
# Rollback to specific revision
helm rollback my-release 3 -n production
# Rollback with wait
helm rollback my-release 3 -n production --wait --timeout 5m
# Rollback and cleanup
helm rollback my-release 3 -n production --cleanup-on-fail
# Show history to find revision
helm history my-release -n productionRollback reverts to a specific revision number. --cleanup-on-fail removes resources created during a failed rollback. Always check helm history before rolling back to identify the correct revision.
Release History
Helm tracks release history. Each install, upgrade, and rollback creates a revision. history shows all revisions with timestamps, status, and description.
# Show release history
helm history my-release -n production
# Show detailed history
helm history my-release -n production --output yaml
# Get release status
helm status my-release -n production
# List all releases
helm list --all-namespaces
# Get release values
helm get values my-release -n production
helm get values my-release -n production --allhelm history shows: revision number, date, status (deployed, superseded, failed), and description. helm get values shows the values used for a specific release. --all shows values from all sources.
Atomic Releases
Atomic releases roll back entirely if any resource fails to install or upgrade. This prevents partial deployments where some resources are updated and others are not. Use --atomic for critical deployments.
# Atomic install — rolls back on failure
helm install my-release ./my-chart -n production --atomic --timeout 5m
# Atomic upgrade — rolls back on failure
helm upgrade my-release ./my-chart -n production --atomic --timeout 5m--atomic combines --wait and --cleanup-on-fail. If any resource fails to become ready, all changes are rolled back. This ensures the cluster is never in a partially-deployed state.
Failed Hook Cleanup
Helm hooks (pre-install, post-install, pre-upgrade, etc.) can fail and leave orphaned resources. Use hook-succeeded or hook-failed deletion policies to clean up hooks after completion or failure.
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "my-chart.fullname" . }}-migrate
annotations:
"helm.sh/hook": pre-install,pre-upgrade
"helm.sh/hook-weight": "0"
"helm.sh/hook-delete-policy": hook-succeeded
spec:
template:
spec:
containers:
- name: migrate
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
command: ["./migrate"]
restartPolicy: Never
backoffLimit: 0hook-delete-policy: hook-succeeded deletes the hook after it succeeds. hook-failed deletes it after failure. hook-succeeded,hook-failed deletes in both cases. Without a policy, hooks are retained.
Create test pods with helm.sh/hook: test annotation. Run helm test my-release to execute tests after install/upgrade. Tests verify the deployment is working correctly.
Mark this lesson complete to store local progress and unlock a cleaner resume path the next time you visit.