Skip to content
Unverified — AI-generated content. Help verify this page

Helm Cheat Sheet

Quick reference for Helm 3 — the package manager for Kubernetes. Covers chart structure, templating, lifecycle commands, hooks, and common patterns.

Related: Kubernetes Cheat Sheet | kubectl Advanced


Repository Management

CommandDescription
helm repo add bitnami https://charts.bitnami.com/bitnamiAdd a chart repository
helm repo add stable https://charts.helm.sh/stableAdd legacy stable repo
helm repo updateUpdate repo index
helm repo listList configured repos
helm repo remove bitnamiRemove a repo
helm search repo nginxSearch repos for a chart
helm search repo nginx --versionsShow all available versions
helm search hub wordpressSearch Artifact Hub

Chart Lifecycle

Install

CommandDescription
helm install my-release bitnami/nginxInstall a chart
helm install my-release bitnami/nginx -n productionInstall in specific namespace
helm install my-release bitnami/nginx -f values.yamlInstall with custom values
helm install my-release bitnami/nginx --set replicaCount=3Install with inline overrides
helm install my-release bitnami/nginx --set-string image.tag="1.25"Force value as string
helm install my-release bitnami/nginx --version 15.0.0Install specific chart version
helm install my-release ./my-chartInstall from local chart directory
helm install my-release my-chart.tgzInstall from local archive
helm install my-release bitnami/nginx --dry-run --debugDry run (render templates only)
helm install my-release bitnami/nginx --wait --timeout 5mWait for pods to be ready
helm install my-release bitnami/nginx --create-namespace -n new-nsCreate namespace if missing

Upgrade

CommandDescription
helm upgrade my-release bitnami/nginxUpgrade a release
helm upgrade my-release bitnami/nginx -f values-prod.yamlUpgrade with new values
helm upgrade my-release bitnami/nginx --reuse-values --set replicas=5Keep existing values, override one
helm upgrade --install my-release bitnami/nginxInstall if not exists, upgrade if it does
helm upgrade my-release bitnami/nginx --atomicAuto-rollback on failure
helm upgrade my-release bitnami/nginx --forceForce resource update

WARNING

--reuse-values merges with existing values. Without it, all values reset to chart defaults plus your overrides. This catches people off guard.

Rollback

CommandDescription
helm rollback my-releaseRollback to previous revision
helm rollback my-release 3Rollback to specific revision
helm rollback my-release 3 --waitRollback and wait for readiness

Uninstall

CommandDescription
helm uninstall my-releaseDelete a release
helm uninstall my-release -n productionDelete from specific namespace
helm uninstall my-release --keep-historyDelete but keep history

Inspect & Debug

CommandDescription
helm listList installed releases in current namespace
helm list -AList releases across all namespaces
helm list --pendingShow pending releases
helm status my-releaseShow release status
helm history my-releaseShow release revision history
helm get values my-releaseShow user-supplied values
helm get values my-release --allShow all computed values
helm get manifest my-releaseShow rendered Kubernetes manifests
helm get notes my-releaseShow release notes
helm get hooks my-releaseShow release hooks
helm show chart bitnami/nginxShow chart metadata
helm show values bitnami/nginxShow default values.yaml
helm show readme bitnami/nginxShow chart README
helm template my-release bitnami/nginx -f values.yamlRender templates locally (no install)

Chart Structure

my-chart/
├── Chart.yaml          # Chart metadata (name, version, dependencies)
├── Chart.lock          # Locked dependency versions
├── values.yaml         # Default configuration values
├── values.schema.json  # JSON Schema for values validation
├── templates/
│   ├── _helpers.tpl    # Template helpers and partials
│   ├── deployment.yaml
│   ├── service.yaml
│   ├── ingress.yaml
│   ├── configmap.yaml
│   ├── hpa.yaml
│   ├── serviceaccount.yaml
│   ├── NOTES.txt       # Post-install instructions
│   └── tests/
│       └── test-connection.yaml
├── charts/             # Dependency chart archives
├── crds/               # Custom Resource Definitions
└── .helmignore         # Files to exclude from packaging

Chart.yaml

yaml
apiVersion: v2
name: my-app
description: My application Helm chart
type: application          # application or library
version: 1.2.0             # Chart version (SemVer)
appVersion: "3.5.1"        # Application version
dependencies:
  - name: postgresql
    version: "12.x.x"
    repository: "https://charts.bitnami.com/bitnami"
    condition: postgresql.enabled
  - name: redis
    version: "17.x.x"
    repository: "https://charts.bitnami.com/bitnami"
    condition: redis.enabled

Templating Essentials

Built-in Objects

ObjectDescription
.Release.NameRelease name
.Release.NamespaceRelease namespace
.Release.IsUpgradeTrue if upgrade/rollback
.Release.IsInstallTrue if install
.Release.RevisionRevision number
.Chart.NameChart name
.Chart.VersionChart version
.Chart.AppVersionApp version
.ValuesValues from values.yaml and overrides
.Capabilities.KubeVersionKubernetes version
.Template.NameCurrent template file path

Common Template Functions

yaml
# String functions
name: {{ .Values.name | upper }}
name: {{ .Values.name | lower }}
name: {{ .Values.name | title }}
name: {{ .Values.name | quote }}
name: {{ .Values.name | trim }}
name: {{ .Values.name | replace "old" "new" }}
name: {{ printf "%s-%s" .Release.Name .Chart.Name }}

# Default values
image: {{ .Values.image | default "nginx:latest" }}

# Required values (fails if missing)
password: {{ required "password is required" .Values.password }}

# Conditionals
{{- if .Values.ingress.enabled }}
  # ingress resources
{{- end }}

# Ternary
replicas: {{ ternary 3 1 .Values.production }}

# Loops
{{- range .Values.env }}
- name: {{ .name }}
  value: {{ .value | quote }}
{{- end }}

# With (change scope)
{{- with .Values.nodeSelector }}
nodeSelector:
  {{- toYaml . | nindent 2 }}
{{- end }}

Helper Templates (_helpers.tpl)

yaml
{{/* Generate standard labels */}}
{{- define "my-app.labels" -}}
helm.sh/chart: {{ include "my-app.chart" . }}
app.kubernetes.io/name: {{ include "my-app.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/* Generate a fullname with release */}}
{{- define "my-app.fullname" -}}
{{- printf "%s-%s" .Release.Name .Chart.Name | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/* Usage in templates */}}
metadata:
  name: {{ include "my-app.fullname" . }}
  labels:
    {{- include "my-app.labels" . | nindent 4 }}

Hooks

Hooks run at specific points in the release lifecycle.

Annotation ValueWhen It Runs
pre-installBefore any resources are installed
post-installAfter all resources are installed
pre-upgradeBefore any resources are upgraded
post-upgradeAfter all resources are upgraded
pre-deleteBefore any resources are deleted
post-deleteAfter all resources are deleted
pre-rollbackBefore a rollback
post-rollbackAfter a rollback
testWhen helm test is run

Hook Example — Database Migration

yaml
apiVersion: batch/v1
kind: Job
metadata:
  name: {{ include "my-app.fullname" . }}-migrate
  annotations:
    "helm.sh/hook": pre-upgrade
    "helm.sh/hook-weight": "0"
    "helm.sh/hook-delete-policy": hook-succeeded
spec:
  template:
    spec:
      restartPolicy: Never
      containers:
        - name: migrate
          image: {{ .Values.image.repository }}:{​{ .Values.image.tag }}
          command: ["npm", "run", "migrate"]
          env:
            - name: DATABASE_URL
              valueFrom:
                secretKeyRef:
                  name: {{ include "my-app.fullname" . }}-secrets
                  key: database-url

Hook Delete Policies

PolicyDescription
hook-succeededDelete after hook succeeds
hook-failedDelete after hook fails
before-hook-creationDelete previous hook before launching new one

Dependencies

bash
# Update dependencies (downloads to charts/)
helm dependency update ./my-chart

# List dependencies
helm dependency list ./my-chart

# Build (rebuild Chart.lock)
helm dependency build ./my-chart

Conditional Dependencies in values.yaml

yaml
# values.yaml
postgresql:
  enabled: true
  auth:
    postgresPassword: "secret"
    database: "myapp"

redis:
  enabled: false

Chart Development

bash
# Create a new chart scaffold
helm create my-chart

# Lint a chart for errors
helm lint ./my-chart

# Lint with specific values
helm lint ./my-chart -f values-prod.yaml

# Package a chart
helm package ./my-chart

# Package with specific version
helm package ./my-chart --version 2.0.0

# Push to OCI registry
helm push my-chart-2.0.0.tgz oci://registry.example.com/charts

# Template (render locally without install)
helm template my-release ./my-chart -f values.yaml --debug

# Run chart tests
helm test my-release

TIP

Always run helm lint and helm template before pushing chart changes. Catch YAML errors locally, not in production.


OCI Registry Support

bash
# Login to OCI registry
helm registry login registry.example.com

# Push chart to OCI
helm push my-chart-1.0.0.tgz oci://registry.example.com/charts

# Pull chart from OCI
helm pull oci://registry.example.com/charts/my-chart --version 1.0.0

# Install from OCI
helm install my-release oci://registry.example.com/charts/my-chart --version 1.0.0


Test Yourself
  1. What command installs a chart with a dry run to preview rendered templates?helm install my-release bitnami/nginx --dry-run --debug

  2. How do you upgrade a release and automatically rollback if it fails?helm upgrade my-release bitnami/nginx --atomic

  3. What command shows the user-supplied values of an installed release?helm get values my-release

  4. How do you render templates locally without installing?helm template my-release ./my-chart -f values.yaml

  5. What hook annotation runs a Job before resources are upgraded?"helm.sh/hook": pre-upgrade

  6. How do you force a value to be treated as a string in --set?--set-string image.tag="1.25"

  7. What does --reuse-values do during an upgrade? It merges new overrides with existing values. Without it, all values reset to chart defaults plus your overrides.

  8. What command checks a chart for errors before deploying?helm lint ./my-chart

  9. How do you keep release history after uninstalling?helm uninstall my-release --keep-history

  10. What built-in object gives you the current release name in a template?.Release.Name

Common Gotchas

  • --reuse-values silently keeps old values. If a chart adds new required values in an upgrade, --reuse-values will not include them. Review chart changelogs before upgrading.
  • Forgetting helm lint before pushing. A YAML indentation error in templates will not show up until install time. Always lint and template-render locally first.
  • Hook resources are not managed by the release. Hooks are created and deleted based on their delete policy. If a hook Job fails, it may linger and block future upgrades.
  • helm upgrade without --install fails if the release does not exist. Use helm upgrade --install for idempotent CI/CD pipelines.

One-Liner Summary

Helm is the package manager for Kubernetes -- master install, upgrade --atomic, template, hooks, and values.yaml overrides to deploy and manage complex applications repeatably.

Last updated: 2026-03-20

"What I cannot create, I do not understand." — Richard Feynman