As applications grow, the number of Kubernetes manifests grows too. A single microservice might need a Deployment, Service, Ingress, ConfigMap, HPA, ServiceAccount, and multiple Secrets. Managing, versioning, and deploying all of these manually is tedious and error-prone. Helm solves this.
What is Helm?
Helm is the package manager for Kubernetes. It introduces three concepts:
- Chart: A collection of Kubernetes manifest templates bundled together. Like an apt package or npm module.
- Release: A running instance of a chart deployed into a cluster. One chart can produce many releases.
- Repository: A collection of charts, hosted publicly or privately.
Installing Helm
# macOS
brew install helm
# Linux
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
# Verify
helm version
Core Helm Commands
# Add a chart repository
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
# Search for charts
helm search repo postgres
helm search hub nginx # search Artifact Hub
# Inspect a chart before installing
helm show values bitnami/postgresql
helm show chart bitnami/postgresql
# Install a chart (creates a release named "my-db")
helm install my-db bitnami/postgresql --set auth.postgresPassword=secret --namespace production
# Install with a custom values file
helm install my-db bitnami/postgresql -f values-prod.yaml --namespace production
# List releases
helm list -A
# Upgrade a release
helm upgrade my-db bitnami/postgresql -f values-prod.yaml --namespace production
# Rollback to previous revision
helm rollback my-db 1 --namespace production
# Uninstall a release
helm uninstall my-db --namespace production
Chart Structure
my-chart/
Chart.yaml # chart metadata (name, version, description)
values.yaml # default configuration values
templates/ # Kubernetes manifest templates
deployment.yaml
service.yaml
ingress.yaml
_helpers.tpl # template helper functions
charts/ # chart dependencies
Template Example
# templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-app
spec:
replicas: {{ .Values.replicaCount }}
template:
spec:
containers:
- name: app
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
# values.yaml
replicaCount: 2
image:
repository: my-app
tag: v1.0.0
Creating Your Own Chart
helm create my-app # scaffold a new chart
helm lint my-app # validate chart
helm template my-app ./ # render templates locally (dry run)
helm install my-app ./ --dry-run --debug # simulate install
Popular Charts
bitnami/postgresql,bitnami/redis,bitnami/kafka— databases and message queuesingress-nginx/ingress-nginx— NGINX Ingress Controllercert-manager/cert-manager— automated TLS certificate managementprometheus-community/kube-prometheus-stack— full monitoring stackargo/argo-cd— GitOps continuous delivery
Next: putting it all together — deploying a real application on Kubernetes with health checks, rolling updates, and resource management.