متقدم
البحث فيأدلة «كيف»
طريقة البحث
  • اكتب المهمة بكلماتك (find port، open firewall، disk full) أو الصق رسالة الخطأ بين علامتي تنصيص.
  • اختر «الإجابة السريعة» لترى الأوامر فقط، أو مجالًا لتبقى في مجال واحد.
  • "كلمتان" تجد العبارة بالضبط.
  • الكلمات العادية تجد الأسماء والنصوص والأمثلة.
  • ↑ ↓ للتنقل · Enter للفتح · Esc للإغلاق · / للبحث
جرّب:

كيف 39Kubernetes · Helm

How to install an app with Helm

Helm installs a complete app — Deployments, Services, ConfigMaps, RBAC — from one chart, with your settings in one values file. The safe way at work is always the same: pin the chart version, keep your values in Git, preview the change, then upgrade --install. This how-to installs a small web app (podinfo) step by step and shows upgrade, rollback, uninstall and OCI charts.

  • 5 الدروس
  • 4 الأوامر

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

$ مستخدم عادي# بصلاحية root (أو مع sudo)

39.1

The quick answer

helm repo add podinfo https://stefanprodan.github.io/podinfo
helm repo update
helm search repo podinfo/podinfo --versions | head -3
helm show values podinfo/podinfo --version CHART_VERSION > values-web.yaml
helm upgrade --install web podinfo/podinfo -n web --create-namespace --version CHART_VERSION -f values-web.yaml --wait
helm list -n web

CHART_VERSION = the version you chose from helm search repo --versions. Always pin it.

الأوامر في هذا الدرس

39.2

Step by step

  1. Find the chart and read it (versions, default values, README):
helm search repo podinfo --versions | head -5
helm show chart podinfo/podinfo --version CHART_VERSION
helm show readme podinfo/podinfo --version CHART_VERSION | less
  1. Write only what you change into your values file (keep it short — the rest are the chart defaults):
values-web.yaml
replicaCount: 2
resources:
  requests:
    cpu: 50m
    memory: 64Mi
  limits:
    memory: 128Mi
ingress:
  enabled: true
  className: nginx
  hosts:
    - host: web.example.com
      paths:
        - path: /
          pathType: Prefix
  1. Preview before you install — render the YAML and let the API server check it:
helm template web podinfo/podinfo -n web --version CHART_VERSION -f values-web.yaml | less
helm upgrade --install web podinfo/podinfo -n web --create-namespace --version CHART_VERSION -f values-web.yaml --dry-run=server
  1. Install (or upgrade) with one command — the same command works the first time and every time after:
helm upgrade --install web podinfo/podinfo -n web --create-namespace --version CHART_VERSION -f values-web.yaml --wait --timeout 5m
kubectl get pods,svc,ingress -n web

--wait waits until the Pods are ready; without it Helm says "deployed" even if the Pods crash.

  1. Daily commands:
CommandDoes
helm list -AAll releases in all namespaces.
helm get values web -n webThe values you gave (-a = all values).
helm history web -n webAll revisions of the release.
helm rollback web 3 -n webBack to revision 3.
helm uninstall web -n webRemove the app (PVCs often stay).
  1. Charts from an OCI registry (no repo add):
helm install cache oci://registry.example.com/charts/redis --version 1.2.0 -n cache --create-namespace
  1. At work: keep values-*.yaml in Git and let Argo CD or Flux install the chart (a HelmRelease or an Argo CD Application) instead of running Helm by hand.

39.3

Check that it worked

helm status web -n web
STATUS: deployed
kubectl rollout status deploy/web-podinfo -n web
kubectl port-forward svc/web-podinfo 9898:9898 -n web

Open http://localhost:9898 — podinfo answers with its version.

39.4

Common problems

ProblemCauseFix
cannot re-use a name that is still in useA release with that name exists.Use helm upgrade --install, or another name.
another operation (install/upgrade/rollback) is in progressA failed or stopped Helm run left the release "pending".helm history; then helm rollback NAME LAST_GOOD.
"deployed", but the Pods crashNo --wait; Helm only applied the YAML.Use --wait; check with kubectl describe pod.
Your value has no effectWrong key (typo or wrong level).Compare with helm show values; helm template and look.
A new chart version broke the appNot pinned — repo update took the newest.Always --version; read the chart's upgrade notes.
rendered manifests contain a resource that already existsThe object was made by hand or by another release.Delete it, or adopt it with Helm labels/annotations (carefully).

39.5

Go further

1Why use helm upgrade --install instead of helm install?

The same command works for the first install and every update — good for scripts and CI.

2Why always pass --version?

Without it Helm takes the newest chart version, which can change the app without warning.

كل الأوامر في هذا الفصل