الفلاتر
طريقة البحث
  • الكلمات العادية تجد الأسماء والنصوص والأمثلة.
  • "كلمتان" تجد العبارة بالضبط.
  • --name أو -x تجد خيارًا.
  • #كلمة تبحث داخل الأوامر فقط.
  • @grep تجد الدروس والمعامل التي تستخدم grep.
  • الفلاتر: cat:network · in:labs · level:rhcsa · ch:8 · root:yes. ضع ! قبل كلمة لاستبعادها. OR بين الكلمات تعني إحداها.
  • ↑ ↓ للتنقل · Enter للفتح · Esc للإغلاق · / للبحث

helm

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

المستوى
خدمة DevSecOps
المجموعة
الحاويات و Kubernetes
يحتاج root
لا
الحزمة
helm

هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.

ماذا يفعل

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.

طريقة الكتابة

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

الأجزاء الرئيسية

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.

الخيارات 8

الأكثر استخدامًا

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.

أمثلة 10

$ مستخدم عادي# بصلاحية root (أو مع 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

انتبه

  • 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.

الملفات

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

نصائح للحفظ

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

رموز الخروج

0Success.
1Error.