Quand vous déployez des applications sur Kubernetes, vous avez besoin d’installer des charts, de mettre à jour des releases, de revenir en arrière en cas de problème, et de déboguer vos déploiements. helm est le gestionnaire de packages de Kubernetes qui orchestre tout cela en une seule commande.
Ce que vous allez apprendre
Section intitulée « Ce que vous allez apprendre »- Installer et mettre à jour des applications avec
helm installethelm upgrade - Gérer le cycle de vie complet : rollback, historique, suppression
- Déboguer avec
helm template,helm lintethelm get - Gérer les repositories et rechercher des charts
- Maîtriser les options essentielles pour la production
La commande helm dans l’écosystème Kubernetes
Section intitulée « La commande helm dans l’écosystème Kubernetes »helm fait partie des outils de déploiement Kubernetes. Chaque outil a sa spécialité :
| Outil | Spécialité | Quand l’utiliser |
|---|---|---|
helm | Gérer des packages (charts) | Déploiements reproductibles, versionnés |
kubectl | Interagir avec l’API K8s | Commandes directes, debug, inspection |
kustomize | Personnaliser des manifests | Overlays sans templating |
argocd | GitOps continu | Synchronisation automatique depuis Git |
flux | GitOps continu | Alternative à ArgoCD |
Combinaisons fréquentes :
# helm + kubectl : vérifier le déploiementhelm install myapp ./chart && kubectl get pods -w
# helm template + kubectl diff : prévisualiser les changementshelm template myapp ./chart | kubectl diff -f -
# helm + grep : filtrer les releaseshelm list -A | grep -i nginxComprendre la commande helm en 2 min
Section intitulée « Comprendre la commande helm en 2 min »Syntaxe générale
Section intitulée « Syntaxe générale »helm [commande] [arguments] [flags]Les 5 commandes que vous utiliserez 80% du temps :
| Commande | Ce qu’elle fait | Exemple |
|---|---|---|
helm install | Déployer un chart | helm install myapp bitnami/nginx |
helm upgrade | Mettre à jour une release | helm upgrade myapp bitnami/nginx |
helm list | Lister les releases | helm list -n prod |
helm uninstall | Supprimer une release | helm uninstall myapp |
helm template | Générer les manifests (debug) | helm template myapp ./chart |
Les 3 objets clés à comprendre
Section intitulée « Les 3 objets clés à comprendre »| Objet | Question | Exemples |
|---|---|---|
| Chart | Quel paquet installer ? | bitnami/nginx, ./mon-chart/ |
| Release | Quel nom donner à l’instance ? | myapp, nginx-prod |
| Values | Comment personnaliser ? | -f values.yaml, --set replicas=3 |
Installation et déploiement
Section intitulée « Installation et déploiement »helm install — Déployer un chart
Section intitulée « helm install — Déployer un chart »helm install <release-name> <chart> [flags]Options principales :
| Option | Description | Exemple |
|---|---|---|
-n, --namespace | Namespace cible | -n production |
-f, --values | Fichier de values | -f values-prod.yaml |
--set | Surcharge inline | --set image.tag=v2.0 |
--create-namespace | Créer le namespace | --create-namespace |
--dry-run | Simuler sans appliquer | --dry-run |
--wait | Attendre que tout soit prêt | --wait --timeout 5m |
--atomic | Rollback auto si échec | --atomic |
Formes courantes :
# Depuis un repositoryhelm install myapp bitnami/nginx
# Depuis un chart localhelm install myapp ./mon-chart/
# Depuis un registry OCIhelm install myapp oci://ghcr.io/org/charts/myapp --version 1.2.3
# Avec personnalisationhelm install myapp bitnami/nginx \ -n production --create-namespace \ -f values-prod.yaml \ --set replicaCount=3
# Mode sécurisé (rollback auto si échec)helm install myapp ./chart \ --atomic \ --timeout 5m \ --waithelm upgrade — Mettre à jour une release
Section intitulée « helm upgrade — Mettre à jour une release »helm upgrade <release-name> <chart> [flags]Options spécifiques à upgrade :
| Option | Description | Exemple |
|---|---|---|
--install | Créer si n’existe pas | --install (idempotent) |
--reuse-values | Garder les anciennes values | --reuse-values |
--reset-values | Revenir aux defaults | --reset-values |
--force | Forcer le remplacement | --force |
Pattern CI/CD (idempotent) :
# Fonctionne que la release existe ou nonhelm upgrade --install myapp ./chart \ -n production \ -f values-prod.yaml \ --atomic \ --waithelm uninstall — Supprimer une release
Section intitulée « helm uninstall — Supprimer une release »helm uninstall <release-name> [flags]Options :
| Option | Description | Exemple |
|---|---|---|
-n, --namespace | Namespace de la release | -n production |
--keep-history | Conserver l’historique | --keep-history |
--dry-run | Simuler la suppression | --dry-run |
# Suppression simplehelm uninstall myapp -n production
# Conserver l'historique (permet rollback ultérieur)helm uninstall myapp --keep-historyGestion du cycle de vie
Section intitulée « Gestion du cycle de vie »helm list — Lister les releases
Section intitulée « helm list — Lister les releases »helm list [flags]Options de filtrage :
| Option | Description | Exemple |
|---|---|---|
-A, --all-namespaces | Tous les namespaces | -A |
-n, --namespace | Namespace spécifique | -n prod |
-a, --all | Inclure les releases supprimées | -a |
--deployed | Seulement les déployées | --deployed |
--failed | Seulement les échouées | --failed |
-o, --output | Format de sortie | -o json |
# Toutes les releases du clusterhelm list -A
# Releases en échechelm list -A --failed
# Format JSON (scripting)helm list -n prod -o json | jq '.[].name'helm history — Historique d’une release
Section intitulée « helm history — Historique d’une release »helm history <release-name> [flags]# Voir l'historiquehelm history myapp -n productionSortie typique :
REVISION UPDATED STATUS CHART APP VERSION DESCRIPTION1 Mon Jan 15 10:00:00 2026 superseded myapp-1.0.0 1.0.0 Install complete2 Mon Jan 15 11:30:00 2026 superseded myapp-1.1.0 1.1.0 Upgrade complete3 Mon Jan 15 14:00:00 2026 deployed myapp-1.1.0 1.1.0 Rollback to 2helm rollback — Revenir en arrière
Section intitulée « helm rollback — Revenir en arrière »helm rollback <release-name> <revision> [flags]Options :
| Option | Description | Exemple |
|---|---|---|
--force | Forcer le rollback | --force |
--wait | Attendre la stabilisation | --wait |
--timeout | Délai maximum | --timeout 5m |
# Rollback à la révision 2helm rollback myapp 2 -n production
# Rollback avec attentehelm rollback myapp 1 --wait --timeout 3mDebug et validation
Section intitulée « Debug et validation »helm template — Générer les manifests
Section intitulée « helm template — Générer les manifests »helm template <release-name> <chart> [flags]La commande la plus importante pour débugger — elle génère les manifests Kubernetes sans les déployer.
# Voir ce que Helm va générerhelm template myapp ./chart -f values.yaml
# Filtrer un type de ressourcehelm template myapp ./chart | grep -A 50 "kind: Deployment"
# Sauvegarder pour inspectionhelm template myapp ./chart -f values-prod.yaml > manifests.yaml
# Avec validation serveur (dry-run)helm template myapp ./chart --validatehelm lint — Valider un chart
Section intitulée « helm lint — Valider un chart »helm lint <chart-path> [flags]# Lint basiquehelm lint ./mon-chart
# Mode strict (warnings = erreurs)helm lint ./mon-chart --strict
# Avec des values spécifiqueshelm lint ./mon-chart -f values-test.yamlNiveaux de messages :
| Niveau | Signification | Action |
|---|---|---|
[INFO] | Recommandation | Optionnel |
[WARNING] | Problème potentiel | À investiguer |
[ERROR] | Erreur bloquante | Doit être corrigée |
helm get — Inspecter une release
Section intitulée « helm get — Inspecter une release »helm get <subcommand> <release-name> [flags]Sous-commandes :
| Sous-commande | Ce qu’elle retourne | Usage |
|---|---|---|
manifest | Manifests déployés | Voir ce qui tourne |
values | Values utilisées | Comprendre la config |
notes | Notes post-install | Instructions d’accès |
all | Tout combiné | Debug complet |
# Manifests actuellement déployéshelm get manifest myapp -n production
# Values utilisées (surcharges uniquement)helm get values myapp -n production
# Toutes les values (défauts + surcharges)helm get values myapp -n production --all
# Notes d'installationhelm get notes myapp -n productionhelm status — État d’une release
Section intitulée « helm status — État d’une release »helm status <release-name> [flags]# État actuelhelm status myapp -n production
# Format JSON (scripting)helm status myapp -o json | jq '.info.status'Gestion des repositories
Section intitulée « Gestion des repositories »helm repo — Gérer les sources de charts
Section intitulée « helm repo — Gérer les sources de charts »helm repo <subcommand> [flags]Sous-commandes :
| Sous-commande | Ce qu’elle fait | Exemple |
|---|---|---|
add | Ajouter un repo | helm repo add bitnami https://... |
list | Lister les repos | helm repo list |
update | Mettre à jour l’index | helm repo update |
remove | Supprimer un repo | helm repo remove bitnami |
# Ajouter les repos essentielshelm repo add bitnami https://charts.bitnami.com/bitnamihelm repo add prometheus-community https://prometheus-community.github.io/helm-chartshelm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
# Mettre à jour l'index localhelm repo update
# Lister les repos configuréshelm repo listhelm search — Rechercher des charts
Section intitulée « helm search — Rechercher des charts »helm search <subcommand> <keyword> [flags]Deux modes de recherche :
| Mode | Ce qu’il cherche | Exemple |
|---|---|---|
repo | Dans vos repos locaux | helm search repo nginx |
hub | Sur Artifact Hub | helm search hub postgresql |
# Dans les repos configuréshelm search repo nginx
# Toutes les versions disponibleshelm search repo nginx --versions
# Sur Artifact Hub (internet)helm search hub postgresql --max-col-width 50helm show — Inspecter un chart
Section intitulée « helm show — Inspecter un chart »helm show <subcommand> <chart> [flags]Sous-commandes :
| Sous-commande | Ce qu’elle montre | Exemple |
|---|---|---|
chart | Métadonnées (Chart.yaml) | helm show chart bitnami/nginx |
values | Values par défaut | helm show values bitnami/nginx |
readme | Documentation | helm show readme bitnami/nginx |
all | Tout | helm show all bitnami/nginx |
# Voir les values par défaut AVANT d'installerhelm show values bitnami/nginx > nginx-defaults.yaml
# Vérifier la version de l'applicationhelm show chart bitnami/nginx | grep appVersionPackaging et distribution
Section intitulée « Packaging et distribution »helm package — Créer un package
Section intitulée « helm package — Créer un package »helm package <chart-path> [flags]# Packager un charthelm package ./mon-chart
# Avec une version spécifiquehelm package ./mon-chart --version 1.2.3
# Dans un dossier spécifiquehelm package ./mon-chart -d ./releases/helm push — Publier sur un registry OCI
Section intitulée « helm push — Publier sur un registry OCI »helm push <chart.tgz> <registry-url># Login au registryhelm registry login ghcr.io
# Push du charthelm push mon-chart-1.2.3.tgz oci://ghcr.io/myorg/chartshelm pull — Télécharger un chart
Section intitulée « helm pull — Télécharger un chart »helm pull <chart> [flags]# Télécharger le .tgzhelm pull bitnami/nginx
# Télécharger et extrairehelm pull bitnami/nginx --untar
# Version spécifiquehelm pull bitnami/nginx --version 15.0.0 --untarPatterns courants
Section intitulée « Patterns courants »Pattern 1 — Déploiement CI/CD idempotent
Section intitulée « Pattern 1 — Déploiement CI/CD idempotent »helm upgrade --install myapp ./chart \ -n production \ --create-namespace \ -f values-prod.yaml \ --atomic \ --wait \ --timeout 5mPourquoi ce pattern ?
--install: crée si n’existe pas (idempotent)--atomic: rollback auto si échec--wait: attend que les pods soient Ready--timeout: évite les blocages infinis
Pattern 2 — Prévisualiser avant upgrade
Section intitulée « Pattern 2 — Prévisualiser avant upgrade »# Voir les changementshelm diff upgrade myapp ./chart -f values.yaml
# Ou sans le plugin diffhelm template myapp ./chart -f values.yaml | kubectl diff -f -Pattern 3 — Debug d’installation échouée
Section intitulée « Pattern 3 — Debug d’installation échouée »# 1. Lint le charthelm lint ./chart --strict
# 2. Vérifier les manifests généréshelm template myapp ./chart -f values.yaml > /tmp/manifests.yaml
# 3. Valider contre le clusterhelm install myapp ./chart --dry-run --debug
# 4. Si déjà installé, inspecterhelm status myapphelm get manifest myappkubectl get events -n production --sort-by='.lastTimestamp'Pattern 4 — Rollback d’urgence
Section intitulée « Pattern 4 — Rollback d’urgence »# Voir l'historiquehelm history myapp -n production
# Rollback à la dernière version stablehelm rollback myapp <revision> -n production --wait
# Vérifierhelm status myapp -n productionkubectl get pods -n productionPattern 5 — Multi-environnements
Section intitulée « Pattern 5 — Multi-environnements »# Devhelm upgrade --install myapp ./chart \ -n dev -f values-base.yaml -f values-dev.yaml
# Staginghelm upgrade --install myapp ./chart \ -n staging -f values-base.yaml -f values-staging.yaml
# Productionhelm upgrade --install myapp ./chart \ -n production -f values-base.yaml -f values-prod.yaml \ --atomic --waitPièges courants
Section intitulée « Pièges courants »| Erreur | Cause | Solution |
|---|---|---|
cannot re-use a name | Release existe déjà | Utiliser helm upgrade --install |
release not found | Mauvais namespace | Ajouter -n namespace |
UPGRADE FAILED: another operation in progress | Opération interrompue | helm rollback ou attendre |
| Values non appliquées | --reuse-values utilisé | Fournir explicitement -f values.yaml |
nil pointer evaluating | Value manquante dans template | Ajouter valeur ou default dans template |
| Timeout dépassé | Pods ne démarrent pas | Vérifier kubectl describe pod |
Cheatsheet
Section intitulée « Cheatsheet »Déploiement
Section intitulée « Déploiement »helm install myapp ./chart -n prod -f values.yaml # Installerhelm upgrade --install myapp ./chart -n prod -f values.yaml # Install/upgrade idempotenthelm upgrade myapp ./chart -n prod -f values.yaml # Mettre à jourhelm uninstall myapp -n prod # SupprimerInspection
Section intitulée « Inspection »helm list -A # Toutes les releaseshelm status myapp -n prod # État d'une releasehelm history myapp -n prod # Historiquehelm get values myapp -n prod --all # Values utiliséeshelm get manifest myapp -n prod # Manifests déployéshelm lint ./chart --strict # Valider le charthelm template myapp ./chart -f values.yaml # Générer manifestshelm install myapp ./chart --dry-run --debug # Simuler avec debugRepositories
Section intitulée « Repositories »helm repo add bitnami https://charts.bitnami.com/bitnamihelm repo updatehelm search repo nginxhelm show values bitnami/nginx > defaults.yamlRollback
Section intitulée « Rollback »helm history myapp -n prod # Voir les révisionshelm rollback myapp 2 -n prod --wait # Revenir à la révision 2À retenir
Section intitulée « À retenir »| Commande | Usage principal |
|---|---|
helm upgrade --install | Déploiement CI/CD idempotent |
helm template | Débugger les manifests générés |
helm lint --strict | Valider un chart avant déploiement |
helm get values --all | Comprendre la config d’une release |
helm rollback | Revenir en arrière en cas de problème |
helm diff upgrade | Prévisualiser les changements (plugin) |