Helm
Helm is the package manager for Kubernetes. A chart is a templated bundle of manifests, an install of a chart into a cluster is a release, and each change produces a numbered revision you can roll back to. Helm 3 talks to the cluster directly (no more Tiller). Commands below checked with helm v3.21.3.
A chart’s structure
helm create mychart
scaffolds:
mychart/
Chart.yaml # name, version, appVersion
values.yaml # default values, overridable at install time
.helmignore
charts/ # vendored subcharts, empty at first
templates/
deployment.yaml
service.yaml
serviceaccount.yaml
ingress.yaml
httproute.yaml # Gateway API route, disabled by default
hpa.yaml
NOTES.txt # message printed after install
_helpers.tpl # reusable template snippets
tests/
test-connection.yaml # a pod run by: helm test <release>
Templates are Go templates; {{ .Values.foo }} pulls from values.yaml (or from overrides at install time).
Two files in that scaffold are opt-in rather than always applied, in two different ways.
httproute.yaml is the Gateway API counterpart of the ingress and stays behind
httpRoute.enabled: false in values.yaml, so a plain render omits it entirely.
templates/tests/ holds manifests annotated "helm.sh/hook": test: helm template still prints
them, but being hooks they are not created on install, only when you call helm test <release>
against a live cluster.
Render and lint locally (no cluster needed)
This is the fast feedback loop while writing a chart:
helm lint mychart # static checks
helm template myrelease mychart # render manifests to stdout, no cluster
helm template myrelease mychart --set replicaCount=3 # override a value
helm template myrelease mychart -f prod-values.yaml # override with a file
helm show chart mychart # Chart.yaml metadata
helm show values mychart # the default values
helm template is the honest way to see exactly what will be applied before touching a cluster.
Install, upgrade, roll back
Against a cluster (uses the current kubectl context and namespace):
helm install myrelease mychart # install a release
helm install myrelease mychart -f prod-values.yaml --set image.tag=1.4.2
helm upgrade --install myrelease mychart # create or update (idempotent)
helm list -A # releases across all namespaces
helm history myrelease # revisions of a release
helm rollback myrelease 2 # roll back to revision 2
helm uninstall myrelease # remove the release
helm status myrelease # current state and notes
helm get values myrelease # values a release was installed with
helm upgrade --install is the usual CI/CD form: it installs on first run and upgrades afterwards.
Repositories
helm repo add <name> <url> # e.g. bitnami https://charts.bitnami.com/bitnami
helm repo update # refresh the local index
helm search repo <term> # find charts
helm show values <name>/<chart> # inspect before installing
helm install myrelease <name>/<chart> -f my-values.yaml
Artifact Hub indexes public charts.
See also
- Official docs: https://helm.sh/docs/
- Kubernetes tooling for the wider kubectl toolbox.