Helm
Install helm binary
brew install helm
sudo snap install helm
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
helm usage
Add helm repo
helm repo add stable https://charts.helm.sh/stable
helm repo update
Add private chart repo
helm repo add --username varac --password $(gopass show --password \
gitlab.com/varac/personal-access-token/cli-api) \
mastodon https://gitlab.com/api/v4/projects/12345/packages/helm/stable
Template
helm dependency update
helm template --validate .
Issues:
If helm template
fails with i.e. Error: chart requires kubeVersion: >=1.24.0-0 which is incompatible with Kubernetes v1.20.0
and kubectl
is the right version use the --validate
or --kube-version
flags:
helm template --kube-version 1.24.0 .
helm template --validate .
See also:
- helm template defaults to --kube-version (Capabilities.KubeVersion) without mentioning it in the --help output
- Wrong cluster version detected (v1.20.0 when I'm running v1.21.2)
Etc
helm history kube-prometheus-stack -n oas
Uninstall all:
helm ls -a --all-namespaces | \
awk 'NR > 1 { print "-n "$2, $1}' | xargs -L1 helm delete
Install charts
https://helm.sh/docs/helm/helm_install/
helm install mariadb stable/mariadb
helm install --name nc-test --set mariadb.enabled=true stable/nextcloud
Test/dry-run install
cd ~/work/git/charts/helm-work/charts/frontend
dasel -f ~/work/git/charts/workcloud-helm/environments/dev/ingress.yaml \
'frontend' > /tmp/val.yml
helm -n varac install --generate-name -f /tmp/val.yml \
--set frontend.backend.url=http://foo.bar .
Install/upgrade local chart:
helm upgrade -n test --create-namespace \
--set TOKEN=de personal-gitlab-exporter .
Only fetch and untar chart for inspection without adding a persistent remote helm repo:
helm fetch --untar --repo https://charts.cloudposse.com/incubator/ \
postfix --version 0.1.1
List chart versions:
helm repo add truecharts https://charts.truecharts.org/
helm repo update
helm search repo truecharts/ntfy --versions
Restart all failing releases:
helm delete --purge $(helm ls | grep FAILED | cut -d ' ' -f 1)
Plugins
Git
- GitHub
- Helm git support is incredibly slow compared to proper helm packages
Helmdiff
https://github.com/databus23/helm-diff
Install:
helm plugin install https://github.com/databus23/helm-diff --version master
Wrappers
helm_upgrade_logs
Wrapper around helm and kubectl to allow easy debugging of a helm release
Use helm together with kustomize
Chart development
Best practices:
Publish charts at own repo
cd ~/kubernetes/charts/varac/helmcharts
find . -maxdepth 1 -type d | egrep -v '^(.|./.git|./public)$' \
| xargs -n 1 helm package -d public
helm repo index public --url https://charts.k.varac.net
Publish helm chart repo at hub.helm.sh
OCI chart repositories
List tags in OCI repo
Workarounds:
With crane:
sudo pacman -S crane
crane ls tccr.io/truecharts/homer
With oras:
pamac install oras
oras repo tags tccr.io/truecharts/homer