📦 Helm = Kubernetes Package Manager
Kubernetes YAML is repetitive. Helm packages Kubernetes apps. Templates, versioning, sharing — like apt/yum for K8s.
📝 Helm Commands
# Install Helm curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash # Add repositories helm repo add bitnami https://charts.bitnami.com/bitnami helm repo add stable https://charts.helm.sh/stable helm repo update # Search charts helm search repo nginx helm search hub nginx # Install chart helm install my-nginx bitnami/nginx helm install my-postgres bitnami/postgresql # List releases helm list helm list -n namespace # Upgrade helm upgrade my-nginx bitnami/nginx --set replicaCount=3 # Rollback helm rollback my-nginx 1 # Uninstall helm uninstall my-nginx # View values helm show values bitnami/nginx # Create chart helm create my-chart
🎯 Creating a Helm Chart
# Chart structure
my-chart/
├── Chart.yaml # Chart metadata
├── values.yaml # Default values
├── templates/ # Kubernetes templates
│ ├── deployment.yaml
│ ├── service.yaml
│ ├── configmap.yaml
│ └── _helpers.tpl # Helper functions
# Chart.yaml
apiVersion: v2
name: my-app
description: My application
type: application
version: 0.1.0
appVersion: 1.16.0
# values.yaml
replicaCount: 1
image:
repository: myapp
tag: latest
pullPolicy: IfNotPresent
service:
type: ClusterIP
port: 80
ingress:
enabled: false
resources:
limits:
cpu: 100m
memory: 128Mi
# templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "my-app.fullname" . }}
labels:
app: {{ include "my-app.name" . }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ include "my-app.name" . }}
template:
metadata:
labels:
app: {{ include "my-app.name" . }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: 80
resources:
{{- toYaml .Values.resources | nindent 12 }}
💡 Best Practices
- Use official repositories when possible
- Version your charts
- Use values.yaml for customization
- Test charts with helm test
- Store charts in Helm repo (ChartMuseum)
“Helm simplifies Kubernetes deployment. Templates, versioning, sharing. Essential for K8s package management.”
