Skip to main content

Helm

Helm is the package manager for Kubernetes. A chart is a package (like an npm package but for K8s manifests).


Conceptsโ€‹

TermWhat it is
ChartA package of Kubernetes manifests
ReleaseA deployed instance of a chart
RepositoryA collection of charts (like a registry)
ValuesConfiguration you pass to customise a chart

Repositoriesโ€‹

helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo add stable https://charts.helm.sh/stable
helm repo update # refresh all repos
helm repo list # show added repos
helm repo remove <name>

helm search repo nginx # search in added repos
helm search hub nginx # search Artifact Hub (public)

Installโ€‹

helm install <release-name> <chart>
helm install my-nginx bitnami/nginx
helm install my-nginx bitnami/nginx -n staging # specific namespace
helm install my-nginx bitnami/nginx --create-namespace # create ns if missing
helm install my-nginx ./my-chart # local chart

Pass custom values:

helm install my-nginx bitnami/nginx \
--set service.type=ClusterIP \
--set replicaCount=2

Or use a values file:

helm install my-nginx bitnami/nginx -f values.yaml

Upgradeโ€‹

helm upgrade <release-name> <chart>
helm upgrade my-nginx bitnami/nginx
helm upgrade my-nginx bitnami/nginx -f values.yaml
helm upgrade my-nginx bitnami/nginx --set replicaCount=3

# Install if not exists, upgrade if it does
helm upgrade --install my-nginx bitnami/nginx -f values.yaml

List Releasesโ€‹

helm list
helm list -n staging
helm list -A # all namespaces

Status & Infoโ€‹

helm status my-nginx
helm get values my-nginx # values used for this release
helm get values my-nginx --all # all values including defaults
helm get manifest my-nginx # rendered K8s manifests

Rollbackโ€‹

helm history my-nginx # show revision history
helm rollback my-nginx # roll back to previous revision
helm rollback my-nginx 2 # roll back to revision 2

Uninstallโ€‹

helm uninstall my-nginx
helm uninstall my-nginx -n staging

Template (Dry Run / Debug)โ€‹

Render the chart to YAML without installing โ€” useful to see what will be applied:

helm template my-nginx bitnami/nginx -f values.yaml
helm template my-nginx bitnami/nginx -f values.yaml > rendered.yaml

Lint a chart for errors:

helm lint ./my-chart

Creating a Chartโ€‹

helm create my-chart # scaffold a new chart

Structure:

my-chart/
โ”œโ”€โ”€ Chart.yaml # metadata (name, version, description)
โ”œโ”€โ”€ values.yaml # default values
โ””โ”€โ”€ templates/ # K8s manifest templates
โ”œโ”€โ”€ deployment.yaml
โ”œโ”€โ”€ service.yaml
โ””โ”€โ”€ ingress.yaml

Reference values in templates with {{ .Values.replicaCount }}.


values.yaml Tipsโ€‹

replicaCount: 2

image:
repository: nginx
tag: "1.25"
pullPolicy: IfNotPresent

service:
type: ClusterIP
port: 80

resources:
limits:
cpu: 500m
memory: 256Mi
requests:
cpu: 100m
memory: 128Mi

Override at install/upgrade time:

helm upgrade my-app ./my-chart \
--set image.tag=1.26 \
--set replicaCount=3

Helm + kubectl Togetherโ€‹

# See what Helm deployed
helm get manifest my-nginx | kubectl apply --dry-run=client -f -

# Debug a failing release
helm status my-nginx
kubectl get pods -l app.kubernetes.io/instance=my-nginx
kubectl logs -l app.kubernetes.io/instance=my-nginx