Repositories and search
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
helm repo list
helm search repo nginx --versions | head
helm show chart bitnami/nginx
helm show values bitnami/nginx > default-values.yamlInstall, upgrade, roll back
helm install web bitnami/nginx -n shop --create-namespace -f values-prod.yaml
helm upgrade --install web bitnami/nginx -n shop -f values-prod.yaml --atomic --timeout 5m
helm list -n shop
helm status web -n shop
helm history web -n shop
helm rollback web 2 -n shop
helm uninstall web -n shopKeep overrides in values files, not --set. --atomic rolls back a failed upgrade.
Inspect and debug
helm template web bitnami/nginx -f values-prod.yaml
helm template web ./chart --debug
helm lint ./chart
helm get values web -n shop
helm get manifest web -n shop
helm diff upgrade web bitnami/nginx -n shop -f values-prod.yamlhelm diff needs the diff plugin. helm template never touches the cluster.
Chart layout
shop/
Chart.yaml name, version, appVersion
values.yaml defaults
templates/
deployment.yaml
service.yaml
_helpers.tpl named templates
charts/ dependencieshelm create shop
helm package ./shop
helm dependency update ./shop
helm push shop-0.1.0.tgz oci://registry.example.com/chartsTemplate syntax
{{ .Values.replicaCount }} read a value
{{ .Release.Name }} {{ .Release.Namespace }} release info
{{ include "shop.fullname" . }} call a helper
{{ .Values.image.tag | default "latest" | quote }}
{{- if .Values.ingress.enabled }} ... {{- end }}
{{- range .Values.hosts }} - {{ . }} {{- end }}
{{- toYaml .Values.resources | nindent 12 }}{{- trims whitespace before the tag. Indentation errors are the most common bug.
Kustomize
kubectl kustomize overlays/production
kubectl apply -k overlays/production
kubectl diff -k overlays/production
kustomize build overlays/production | kubectl apply -f -apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../base
namespace: shop
images:
- name: registry.example.com/shop/api
newTag: 1.8.2
patches:
- path: replica-patch.yamlBase files stay valid YAML; overlays patch them per environment.
Find and inspect charts
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
helm search repo nginx --versions | head
helm show values bitnami/nginx > values-default.yaml
helm show chart bitnami/nginx
helm pull bitnami/nginx --untar --version 18.2.0
helm lint ./mychart
helm template web ./mychart -f values-prod.yaml | lessInstall, upgrade, roll back
helm install web ./mychart -n shop --create-namespace -f values-prod.yaml
helm upgrade --install web ./mychart -n shop -f values-prod.yaml --atomic --timeout 5m
helm upgrade web ./mychart -n shop --reuse-values --set image.tag=1.5
helm diff upgrade web ./mychart -n shop -f values-prod.yaml
helm list -A
helm status web -n shop
helm history web -n shop
helm rollback web 3 -n shop --wait
helm get values web -n shop --all
helm get manifest web -n shop
helm test web -n shopRemove
helm uninstall web -n shop --dry-run
helm uninstall web -n shop
helm uninstall web -n shop --keep-history