Filters
Zo zoek je
  • Gewone woorden vinden namen, teksten en voorbeelden.
  • "twee woorden" vindt precies die zin.
  • --naam of -x vindt een optie.
  • #woord zoekt alleen in commando's.
  • @grep vindt lessen en labs die grep gebruiken.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Zet ! voor een woord om het weg te laten. OR tussen woorden betekent één ervan.
  • ↑ ↓ bewegen · Enter openen · Esc sluiten · / zoeken

helm

The package manager for Kubernetes: install, upgrade and roll back apps packed as charts.

Niveau
DevSecOps-service
Groep
Containers en Kubernetes
Root nodig
Nee
Pakket
helm

Dit deel is nog niet vertaald. Je ziet de Engelse tekst.

Wat het doet

A chart is a folder of YAML templates plus values.yaml with default settings. helm install renders the templates with your values and creates a release in the cluster. Helm keeps the history of every release, so helm rollback returns to an old version. Charts come from repositories (HTTP) or OCI registries (oci://ghcr.io/…).

Most cluster add-ons are installed with Helm: ingress-nginx, cert-manager, kube-prometheus-stack, Argo CD, Vault, Falco.

Zo schrijf je het

helm install|upgrade RELEASE CHART [-n NS] [-f values.yaml] [--set k=v]
helm repo add NAME URL

Belangrijkste delen

Commands

repo add / update / list
Manage chart repositories.
search repo|hub WORD
Find charts.
show values CHART
Show the default values.
install RELEASE CHART
Install a chart.
upgrade [--install] RELEASE CHART
Upgrade (or install).
list [-A]
List releases.
status RELEASE
Show release status and notes.
history RELEASE
Revisions of a release.
rollback RELEASE [REV]
Go back to an old revision.
uninstall RELEASE
Remove a release.
template RELEASE CHART
Render YAML locally, install nothing.
get values|manifest RELEASE
Show what was installed.
create NAME
Make a new chart skeleton.
lint DIR
Check a chart for errors.
package DIR / push FILE oci://…
Build and publish a chart.
pull CHART [--untar]
Download a chart.
dependency update
Download sub-charts.

Opties 8

Meest gebruikt

Common flags

-n NS / --create-namespace
Namespace (create it).
-f FILE
Values file (repeat; later files win).
--set key=value
Change one value.
--version VER
Chart version to use.
--atomic
Roll back by itself if the upgrade fails.
--wait / --timeout 5m
Wait until resources are ready.
--dry-run
Simulate.
--reuse-values / --reset-values
Keep / reset earlier values on upgrade.

Voorbeelden 10

$ als gewone gebruiker# als root (of met sudo)

  1. 1Add a repository and find a chart

    helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
    helm repo update
    helm search repo ingress-nginx
  2. 2Read the defaults and write your own values

    helm show values ingress-nginx/ingress-nginx > values-default.yaml
    cat values-ingress.yaml
    controller:
      replicaCount: 2
      service:
        type: LoadBalancer
  3. 3Install into its own namespace

    helm install ingress ingress-nginx/ingress-nginx -n ingress-nginx --create-namespace -f values-ingress.yaml --version 4.11.3
  4. 4Upgrade safely, with automatic rollback

    helm upgrade --install ingress ingress-nginx/ingress-nginx -n ingress-nginx -f values-ingress.yaml --atomic --wait --timeout 5m
  5. 5See history and roll back

    helm history ingress -n ingress-nginx
    helm rollback ingress 2 -n ingress-nginx
  6. 6Render YAML to review or scan

    helm template shop ./charts/shop -f values-prod.yaml > rendered.yaml
    trivy config rendered.yaml
  7. 7Install the monitoring stack

    helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
    helm install monitoring prometheus-community/kube-prometheus-stack -n monitoring --create-namespace
  8. 8Use a chart from an OCI registry

    helm install argocd oci://ghcr.io/argoproj/argo-helm/argo-cd -n argocd --create-namespace
  9. 9Make, check and publish your own chart

    helm create shop
    helm lint ./shop
    helm package ./shop
    helm push shop-0.1.0.tgz oci://ghcr.io/s0sta/charts
  10. 10See what a release changed

    helm get values ingress -n ingress-nginx
    helm get manifest ingress -n ingress-nginx | less

Let op

  • Pin --version; without it you get whatever is newest that day.
  • Do not put secrets in values.yaml in Git; use External Secrets, SOPS or sealed secrets.
  • Helm stores releases as Secrets in the namespace — RBAC there matters.

Bestanden

~/.config/helm/repositories.yaml
Added repositories.
~/.cache/helm/
Downloaded charts.
Chart.yaml, values.yaml, templates/
Parts of a chart.

Tips om te onthouden

  • In GitOps, Argo CD or Flux renders the chart for you; keep only values files in Git.

Exitcodes

0Success.
1Error.