Aller au contenu
Conteneurs & Orchestration medium

Distribution Helm via OCI : publier des charts sur registries modernes

10 min de lecture

logo helm

Les registries OCI (Open Container Initiative) permettent de stocker des charts Helm au même endroit que vos images Docker. Un seul registry, une seule authentification, une gestion unifiée des artefacts. Depuis Helm 3.8+, le support OCI est stable et recommandé pour les environnements de production.


GénérationMécanismeLimitations
Helm 2Repos HTTP (index.yaml + tarballs)Serveur web dédié, pas de sécurité native
Helm 3Repos HTTP améliorésToujours un index.yaml à maintenir
Helm 3.8+OCI registriesMême infra que les images, authentification intégrée
AspectRepos HTTP classiquesOCI registries
InfrastructureServeur web dédié + index.yamlVotre registry d’images existant
AuthentificationBasic auth ou tokens customMême auth que vos images Docker
ImmutabilitéDépend de votre configNative (un tag = un digest)
SignatureFichier .prov séparéCosign/Notation intégrés
Découvertehelm search repohelm search + UI du registry

Fenêtre de terminal
# Login avec username/password
helm registry login harbor.example.com
# Login avec robot account (CI/CD)
helm registry login harbor.example.com \
--username 'robot$myproject+ci' \
--password-stdin < /path/to/token

  1. Vérifier le chart

    Avant de publier, validez la qualité :

    Fenêtre de terminal
    helm lint ./my-chart
    helm template ./my-chart > /dev/null # Vérifie le rendu
  2. Packager le chart

    Fenêtre de terminal
    helm package ./my-chart
    # Crée my-chart-1.2.3.tgz

    La version vient de Chart.yaml :

    Chart.yaml
    apiVersion: v2
    name: my-chart
    version: 1.2.3 # Version du chart
    appVersion: "2.0.0" # Version de l'application
  3. Pousser vers le registry

    Fenêtre de terminal
    helm push my-chart-1.2.3.tgz oci://harbor.example.com/myproject

    Résultat :

    Pushed: harbor.example.com/myproject/my-chart:1.2.3
    Digest: sha256:abc123...
  4. Vérifier la publication

    Fenêtre de terminal
    helm show chart oci://harbor.example.com/myproject/my-chart --version 1.2.3
Fenêtre de terminal
# Lint → Package → Push
helm lint ./my-chart && \
helm package ./my-chart && \
helm push my-chart-*.tgz oci://harbor.example.com/myproject

Fenêtre de terminal
# Installer depuis OCI
helm install my-release oci://harbor.example.com/myproject/my-chart \
--version 1.2.3 \
-n my-namespace \
--create-namespace
Fenêtre de terminal
# Télécharger le chart
helm pull oci://harbor.example.com/myproject/my-chart --version 1.2.3
# Installer depuis le tarball local
helm install my-release ./my-chart-1.2.3.tgz -n my-namespace
Fenêtre de terminal
# Voir les métadonnées
helm show chart oci://harbor.example.com/myproject/my-chart --version 1.2.3
# Voir les values par défaut
helm show values oci://harbor.example.com/myproject/my-chart --version 1.2.3
# Voir le README
helm show readme oci://harbor.example.com/myproject/my-chart --version 1.2.3

oci://<registry>/<project>/<chart-name>:<version>
ExempleRegistryProjectChartVersion
oci://harbor.example.com/platform/nginxharbor.example.complatformnginx(latest)
oci://ghcr.io/myorg/charts/api:2.1.0ghcr.iomyorg/chartsapi2.1.0
SituationVersion chartTag OCI
Release stable1.2.31.2.3
Pre-release1.2.3-rc.11.2.3-rc.1
Branche feature0.0.0-feature-xyzfeature-xyz
CI automatique1.2.3+build.4561.2.3
Fenêtre de terminal
# Référencer par digest (immuable)
helm install my-release oci://harbor.example.com/myproject/my-chart@sha256:abc123...

RegistryURL formatNotes
Harboroci://harbor.example.com/projectGratuit, self-hosted, UI native pour charts
GHCRoci://ghcr.io/owner/repoIntégré à GitHub, gratuit pour public
ECRoci://123456.dkr.ecr.region.amazonaws.comAWS natif, IAM intégré
ACRoci://myregistry.azurecr.ioAzure natif
GCR/Artifact Registryoci://region-docker.pkg.dev/project/repoGoogle Cloud
Docker Huboci://registry-1.docker.io/userLimites de pull sur free tier

ErreurCause probableSolution
unauthorizedToken expiré ou permissions insuffisanteshelm registry logout puis login
manifest unknownChart ou version inexistantVérifier le nom et la version
denied: requested access...Pas de permission pushVérifier les droits sur le projet
Error: scheme "oci" not supportedHelm < 3.8Mettre à jour Helm

Objectif : Packager un chart, le publier sur GHCR (ou Harbor local), puis l’installer depuis oci://.

  1. Préparer le chart

    Fenêtre de terminal
    # Utiliser un chart existant ou en créer un
    helm create my-lab-chart
    cd my-lab-chart
    # Modifier la version dans Chart.yaml
    sed -i 's/version: .*/version: 0.1.0/' Chart.yaml
  2. Se connecter au registry

    Fenêtre de terminal
    # GHCR
    echo $GITHUB_TOKEN | helm registry login ghcr.io -u $GITHUB_USERNAME --password-stdin
  3. Packager et publier

    Fenêtre de terminal
    cd ..
    helm package my-lab-chart
    helm push my-lab-chart-0.1.0.tgz oci://ghcr.io/$GITHUB_USERNAME/charts
  4. Vérifier et installer

    Fenêtre de terminal
    # Vérifier
    helm show chart oci://ghcr.io/$GITHUB_USERNAME/charts/my-lab-chart --version 0.1.0
    # Installer
    helm install test-release oci://ghcr.io/$GITHUB_USERNAME/charts/my-lab-chart \
    --version 0.1.0 \
    -n oci-lab \
    --create-namespace
  5. Nettoyer

    Fenêtre de terminal
    helm uninstall test-release -n oci-lab
    kubectl delete namespace oci-lab

Critères de réussite :

  • Chart packagé (.tgz créé)
  • Push vers registry OCI réussi
  • helm show chart oci://... affiche les métadonnées
  • Installation depuis oci:// fonctionnelle

  • OCI = standard ouvert pour stocker charts et images au même endroit
  • helm registry login = authentification (même credentials que Docker)
  • helm push = publier un chart packagé
  • helm pull / helm install oci:// = consommer depuis OCI
  • Immutabilité : ne jamais écraser un tag en production
  • Digests : utilisez @sha256:... pour la reproductibilité absolue

Ce site vous est utile ?

Sachez que moins de 1% des lecteurs soutiennent ce site.

Je maintiens +700 guides gratuits, sans pub ni tracing. Aujourd'hui, ce site ne couvre même pas mes frais d'hébergement, d'électricité, de matériel, de logiciels, mais surtout de cafés.

Un soutien régulier, même symbolique, m'aide à garder ces ressources gratuites et à continuer de produire des guides de qualité. Merci pour votre appui.