Helm β Kubernetes Package Manager
Helm β Kubernetes Package Manager
Section titled βHelm β Kubernetes Package ManagerβHelm is the package manager for Kubernetes. It bundles multiple Kubernetes manifests into a chart β a reusable, versioned, configurable unit.
Why Helm
Section titled βWhy HelmβWithout Helm you manage many YAML files manually. Helm:
- Templates manifests with variables (image tag, replica count, etc.)
- Versions deployments (install, upgrade, rollback)
- Packages applications for sharing via repositories
Installing Helm
Section titled βInstalling Helmβ# macOSbrew install helm
# Windows (winget)winget install Helm.Helm
# Linuxcurl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bashChart Structure
Section titled βChart Structureβmy-chart/βββ Chart.yaml # chart metadata (name, version, description)βββ values.yaml # default configuration valuesβββ templates/β βββ deployment.yamlβ βββ service.yamlβ βββ ingress.yamlβ βββ _helpers.tpl # named template helpersβββ charts/ # dependent chartsChart.yaml:
apiVersion: v2name: my-appdescription: My application chartversion: 1.0.0appVersion: "2.3.1"values.yaml
Section titled βvalues.yamlβDefault values that users can override:
replicaCount: 2
image: repository: myrepo/my-app tag: "1.0" pullPolicy: IfNotPresent
service: type: ClusterIP port: 80
ingress: enabled: falseTemplate Files
Section titled βTemplate FilesβTemplates use Go templating. Reference values with {{ .Values.key }}:
apiVersion: apps/v1kind: Deploymentmetadata: name: {{ .Release.Name }}-appspec: replicas: {{ .Values.replicaCount }} template: spec: containers: - name: {{ .Chart.Name }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"Essential Commands
Section titled βEssential Commandsβ# Add a repositoryhelm repo add bitnami https://charts.bitnami.com/bitnamihelm repo update
# Search for chartshelm search repo nginx
# Install a charthelm install my-release bitnami/nginx
# Install with custom valueshelm install my-release bitnami/nginx \ --set replicaCount=3 \ --values custom-values.yaml
# List installed releaseshelm list
# Upgrade a releasehelm upgrade my-release bitnami/nginx --set replicaCount=5
# Rollback to previous versionhelm rollback my-release 1
# Uninstallhelm uninstall my-release
# Preview rendered templates without installinghelm template my-release ./my-chart
# Check for issues before installhelm lint ./my-chartOverriding Values at Install
Section titled βOverriding Values at InstallβInline:
helm install my-app ./my-chart \ --set image.tag=2.0 \ --set replicaCount=5Values file:
helm install my-app ./my-chart -f prod-values.yamlprod-values.yaml:
replicaCount: 5image: tag: "2.0"ingress: enabled: truePopular Chart Repositories
Section titled βPopular Chart Repositoriesβhelm repo add ingress-nginx https://kubernetes.github.io/ingress-nginxhelm repo add cert-manager https://charts.jetstack.iohelm repo add prometheus https://prometheus-community.github.io/helm-chartshelm repo add bitnami https://charts.bitnami.com/bitnami