Helm Cheatsheet - Manage Kubernetes Applications

Helm cheatsheet for managing Kubernetes applications. Learn how to install, manage releases, perform rollbacks, and work with Helm repositories.

Helm Cheatsheet
Helm helps you manage Kubernetes applications

Helm simplifies the deployment and management of applications on Kubernetes. This cheatsheet provides a quick reference for common Helm commands and configurations.

Table of Contents Installing Helm

From a script:

curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash

On Mac:

brew install helm

Manually from their releases:

wget https://get.helm.sh/helm-v3.9.4-darwin-amd64.tar.gz
tar helm-v3.9.4-darwin-amd64.tar.gz
mv darwin-amd64/helm /usr/local/bin
Global Flags

List of global flags of version v3.9.3:

Global Flags:
      --debug                       enable verbose output
      --kube-apiserver string       the address and the port for the Kubernetes API server
      --kube-as-group stringArray   group to impersonate for the operation, this flag can be repeated to specify multiple groups.
      --kube-as-user string         username to impersonate for the operation
      --kube-ca-file string         the certificate authority file for the Kubernetes API server connection
      --kube-context string         name of the kubeconfig context to use
      --kube-token string           bearer token used for authentication
      --kubeconfig string           path to the kubeconfig file
  -n, --namespace string            namespace scope for this request
      --registry-config string      path to the registry config file (default "~/Library/Preferences/helm/registry/config.json")
      --repository-cache string     path to the file containing cached repository indexes (default "~/Library/Caches/helm/repository")
      --repository-config string    path to the file containing repository names and URLs (default "~/Library/Preferences/helm/repositories.yaml")
Releases

List a release:

helm ls --namespace <namespace>

View the history of releases:

helm history <release> --namespace <namespace>
Repositories

List repositories:

helm repo list

Add a repository:

helm repo add prometheus-community https://prometheus-community.github.io/helm-charts

Update repositories:

helm repo update

Remove a repository:

helm repo remove prometheus-community
Rollbacks

Rollback to a specific revision:

helm rollback <release> <revision> --namespace <namespace>

Rollback to the previous revision:

helm rollback <release> 0 --namespace <namespace>
Search

Search all release versions of a chart:

helm search repo prometheus-community/kube-prometheus-stack --versions

Search for release versions that starts with a specific number:

helm search repo prometheus-community/kube-prometheus-stack --versions --version "^31.0"

Search for release versions as a minimum and up:

helm search repo prometheus-community/kube-prometheus-stack --versions --version ">31.0"

Search for a repo with regular expressions:

helm search repo -r "bitnami/(re-).*"
Show

Show the chart's values:

helm show values prometheus-community/kube-prometheus-stack --version "39.0.0"

Dumpe the chart's values to a file:

helm show values prometheus-community/kube-prometheus-stack --version "39.0.0" > values.yaml
Install

Install a release with a local chart:

helm install my-hostname . -f values.yaml
Upgrade

Upgrade a release with a local chart and specify a timeout:

helm upgrade my-hostname . -f values.yaml --timeout 10s
History

View the deployment history:

helm history chart-name
Rollbacks

Rollback to most recent version:

helm rollback chart-name

Rollback to specific version:

helm rollback chart-name 2
Chart Museum
helm plugin install https://github.com/chartmuseum/helm-push
helm repo add cm --username ${HELM_REPO_USERNAME} --password ${HELM_REPO_PASSWORD} https://chartmuseum.mydomain.com/
helm create mychart
# helm package mychart # or cd mychart; helm package .
# helm dependency build -> if you are in the chart directory with dependency in the Chart.yaml
cd mychart
helm cm-push . -f --username ${HELM_REPO_USERNAME} --password ${HELM_REPO_PASSWORD} https://chartmuseum.mydomain.com/ # chart name will be the directory name
Helm Chart Resources Charts Access Values

Access --set env=dev in a chart:

{{ .Values.env | quote }}