Helm Cheat Sheet¶
Name origin: Helm means "ship's steering wheel" — fitting the nautical Kubernetes naming theme (kubernetes = Greek for "helmsman"). Helm is the "package manager for Kubernetes," analogous to apt/yum for Linux.
Core Commands¶
# Search for charts
helm search repo nginx
helm search hub prometheus # Artifact Hub
# Install
helm install myapp ./chart/ # From local directory
helm install myapp repo/chart # From repo
helm install myapp repo/chart -f values-prod.yaml -n production
# Upgrade
helm upgrade myapp repo/chart -f values.yaml
helm upgrade --install myapp repo/chart # Install if not exists
# Rollback
helm rollback myapp 1 # Rollback to revision 1
helm rollback myapp 0 # Rollback to previous
# Gotcha: rollback creates a NEW revision (not a revert). Revision history grows.
# Uninstall
helm uninstall myapp -n production
# Status
helm list -A # All releases, all namespaces
helm status myapp -n production
helm history myapp -n production # Revision history
Gotcha:
helm upgradewithout--reuse-valuesresets all values to chart defaults, then applies only the values you explicitly pass. This silently drops custom values from previous installs. Always usehelm upgrade -f values.yamlwith your full values file, or use--reuse-valuesto keep previous values (but beware:--reuse-valuesdoes not pick up new chart default changes).
Debugging¶
# Render templates without installing
helm template myapp ./chart/ -f values.yaml
# Dry-run against cluster (validates API compatibility)
helm install myapp ./chart/ --dry-run --debug
# Show computed values
helm get values myapp -n production
helm get values myapp -n production --all # Including defaults
# Show generated manifests
helm get manifest myapp -n production
# Lint chart
helm lint ./chart/
Chart Structure¶
mychart/
├── Chart.yaml # Name, version, dependencies
├── values.yaml # Default values
├── templates/
│ ├── deployment.yaml
│ ├── service.yaml
│ ├── ingress.yaml
│ ├── _helpers.tpl # Template helpers (named templates)
│ ├── NOTES.txt # Post-install message
│ └── tests/
│ └── test-connection.yaml
├── charts/ # Dependency charts
└── .helmignore
Values & Templating¶
# values.yaml
replicaCount: 3
image:
repository: myapp
tag: "v1.0"
pullPolicy: IfNotPresent
# In templates:
replicas: {{ .Values.replicaCount }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
# Conditionals
{{- if .Values.ingress.enabled }}
apiVersion: networking.k8s.io/v1
kind: Ingress
...
{{- end }}
# Loops
{{- range .Values.extraEnv }}
- name: {{ .name }}
value: {{ .value | quote }}
{{- end }}
# Default values
{{ .Values.resources.limits.cpu | default "500m" }}
Dependency Management¶
# Chart.yaml
dependencies:
- name: postgresql
version: "12.x.x"
repository: https://charts.bitnami.com/bitnami
condition: postgresql.enabled
Repository Management¶
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo add prometheus https://prometheus-community.github.io/helm-charts
helm repo update
helm repo list
Common Flags¶
| Flag | Purpose |
|---|---|
-f values.yaml |
Override values file |
--set key=val |
Override single value |
--set-string key=val |
Force string type |
-n namespace |
Target namespace |
--create-namespace |
Create namespace if needed |
--wait |
Wait until all resources are ready |
--timeout 5m |
Timeout for --wait |
--atomic |
Rollback on failure |
Troubleshooting¶
| Problem | Command |
|---|---|
| See what changed | helm diff upgrade myapp ./chart/ (helm-diff plugin) |
| Stuck in pending | helm rollback myapp 0 |
| Bad values | helm get values myapp |
| Template error | helm template myapp ./chart/ --debug |
| Release not found | helm list -A --all (includes failed/uninstalled) |