Helm Charts Guide
Chart Structure
my-chart/
├── Chart.yaml # Chart metadata
├── values.yaml # Default configuration values
├── charts/ # Chart dependencies
├── templates/
│ ├── deployment.yaml
│ ├── service.yaml
│ ├── ingress.yaml
│ ├── configmap.yaml
│ ├── _helpers.tpl # Template helpers
│ └── NOTES.txt # Post-install notes
└── .helmignore
values.yaml & Template Usage
# values.yaml
replicaCount: 3
image:
repository: myregistry/myapp
tag: "1.2.3"
pullPolicy: IfNotPresent
service:
type: ClusterIP
port: 80
ingress:
enabled: true
host: example.com
resources:
limits:
cpu: 500m
memory: 256Mi
# templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "my-chart.fullname" . }}
labels:
{{- include "my-chart.labels" . | nindent 4 }}
spec:
replicas:
template:
spec:
containers:
- name:
image: ":"
imagePullPolicy:
Common Helm Commands
# Add repo
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
# Search
helm search repo bitnami/postgresql
# Install
helm install my-release bitnami/postgresql \
--namespace db --create-namespace \
--set auth.postgresPassword=secret
# Install from local chart
helm install my-app ./my-chart -f custom-values.yaml
# Upgrade
helm upgrade my-release bitnami/postgresql \
--set image.tag=16.1.0
# Upgrade or install
helm upgrade --install my-release ./my-chart
# Rollback
helm rollback my-release 1 # rollback to revision 1
# Status and history
helm status my-release
helm history my-release
# Uninstall
helm uninstall my-release
# Dry-run and debug
helm install --dry-run --debug my-app ./my-chart
helm template my-app ./my-chart