cert-manager-webhook-ovh
Ce chart déploie le webhook OVH pour cert-manager, permettant l'utilisation du challenge DNS-01 avec OVH pour obtenir des certificats wildcard Let's Encrypt.
Configuration des credentials OVH
Les credentials OVH peuvent être gérés de deux façons :
Option 1 : Secret Kubernetes classique (par défaut)
Méthode A : Via values.yaml (recommandé si vous n'utilisez pas External Secrets)
Configurez les credentials dans values.yaml :
externalSecret:
enabled: false # External Secrets désactivé
ovhCredentials:
applicationKey: "VOTRE_APPLICATION_KEY"
applicationSecret: "VOTRE_APPLICATION_SECRET"
consumerKey: "VOTRE_CONSUMER_KEY"
Le chart créera automatiquement le secret cert-manager-webhook-ovh dans les deux namespaces (cert-manager-webhook-ovh-ops et cert-manager-ops).
Méthode B : Création manuelle via kubectl
Créez manuellement le Secret cert-manager-webhook-ovh dans les deux namespaces :
# Dans cert-manager-webhook-ovh-ops
kubectl create secret generic cert-manager-webhook-ovh \
--from-literal=application-key="VOTRE_APPLICATION_KEY" \
--from-literal=application-secret="VOTRE_APPLICATION_SECRET" \
--from-literal=consumer-key="VOTRE_CONSUMER_KEY" \
-n cert-manager-webhook-ovh-ops \
--context=cluster-ops
# Dans cert-manager-ops
kubectl create secret generic cert-manager-webhook-ovh \
--from-literal=application-key="VOTRE_APPLICATION_KEY" \
--from-literal=application-secret="VOTRE_APPLICATION_SECRET" \
--from-literal=consumer-key="VOTRE_CONSUMER_KEY" \
-n cert-manager-ops \
--context=cluster-ops
Option 2 : External Secrets Operator - Stratégie Multi-Namespace (recommandé)
Utilisez External Secrets Operator pour synchroniser automatiquement les credentials depuis HashiCorp Vault dans plusieurs namespaces en utilisant un ClusterSecretStore partagé.
Avantages de la stratégie Multi-Namespace
- ✅ Un seul ClusterSecretStore : Configuration centralisée pour tous les namespaces
- ✅ Synchronisation automatique : Les secrets sont créés automatiquement dans chaque namespace
- ✅ Rotation automatique : Les secrets sont rafraîchis automatiquement selon
refreshInterval - ✅ Sécurité : Les credentials ne sont jamais stockés en clair dans Git
- ✅ Partage facile : Le même secret est disponible dans
cert-manager-opsetcert-manager-webhook-ovh-ops
Prérequis
- External Secrets Operator installé dans le cluster
- HashiCorp Vault configuré avec un rôle Kubernetes auth
- ServiceAccount configuré : Le ServiceAccount
cert-manager-webhook-ovh-sadoit être autorisé dans Vault pour les namespacescert-manager-opsetcert-manager-webhook-ovh-ops
Configuration dans Vault
Créez un rôle Vault pour l'authentification Kubernetes :
# Configuration du rôle Vault
vault write auth/kubernetes/role/cert-manager-webhook-ovh-role \
bound_service_account_names=cert-manager-webhook-ovh-sa \
bound_service_account_namespaces=cert-manager-webhook-ovh-ops,cert-manager-ops \
policies=cert-manager-webhook-ovh-policy \
ttl=1h
# IMPORTANT : Ne configurez PAS bound_service_account_namespace_selector
# Utilisez bound_service_account_namespaces avec une liste de namespaces
Créez une policy Vault pour accéder aux secrets OVH :
vault policy write cert-manager-webhook-ovh-policy - <<EOF
path "secret/data/ovh" {
capabilities = ["read"]
}
EOF
Stockez les credentials OVH dans Vault :
vault kv put secret/ovh \
application-key="VOTRE_APPLICATION_KEY" \
application-secret="VOTRE_APPLICATION_SECRET" \
consumer-key="VOTRE_CONSUMER_KEY"
Configuration dans values.yaml
Activez External Secrets dans values.yaml :
externalSecret:
enabled: true
refreshInterval: "1h"
secretName: "cert-manager-webhook-ovh"
remoteRef:
applicationKey: "secret/data/ovh#application-key"
applicationSecret: "secret/data/ovh#application-secret"
consumerKey: "secret/data/ovh#consumer-key"
vault:
secretStoreName: "vault-backend"
server: "https://vault.example.com:8200"
path: "secret"
version: "v2"
auth:
kubernetes:
mountPath: "kubernetes"
role: "cert-manager-webhook-ovh-role" # Nom du rôle Vault
serviceAccountRef:
name: "cert-manager-webhook-ovh-sa"
namespace: "cert-manager-webhook-ovh-ops"
Fonctionnement
- ClusterSecretStore : Un seul
ClusterSecretStoreest créé pour Vault (accessible depuis tous les namespaces) - ExternalSecrets multiples : Deux
ExternalSecretsont créés :- Un dans
cert-manager-webhook-ovh-ops(namespace du chart) - Un dans
cert-manager-ops(namespace de cert-manager)
- Un dans
- Secrets synchronisés : Chaque
ExternalSecretcrée le Secretcert-manager-webhook-ovhdans son namespace respectif - Synchronisation automatique : Les secrets sont rafraîchis automatiquement selon
refreshInterval
Vérification
# Vérifier le ClusterSecretStore
kubectl get clustersecretstore vault-backend --context=cluster-ops
# Vérifier les ExternalSecrets
kubectl get externalsecret -n cert-manager-webhook-ovh-ops --context=cluster-ops
kubectl get externalsecret -n cert-manager-ops --context=cluster-ops
# Vérifier les Secrets créés
kubectl get secret cert-manager-webhook-ovh -n cert-manager-webhook-ovh-ops --context=cluster-ops
kubectl get secret cert-manager-webhook-ovh -n cert-manager-ops --context=cluster-ops
# Vérifier le statut de synchronisation
kubectl describe externalsecret cert-manager-webhook-ovh -n cert-manager-webhook-ovh-ops --context=cluster-ops
kubectl describe externalsecret cert-manager-webhook-ovh -n cert-manager-ops --context=cluster-ops
Dépannage
Erreur "invalid bound_service_account_namespace_selector configured"
Cette erreur se produit lors de la création d'un rôle Vault. Ne configurez PAS bound_service_account_namespace_selector. Utilisez plutôt bound_service_account_namespaces :
# ✅ Configuration CORRECTE
vault write auth/kubernetes/role/cert-manager-webhook-ovh-role \
bound_service_account_names=cert-manager-webhook-ovh-sa \
bound_service_account_namespaces=cert-manager-webhook-ovh-ops,cert-manager-ops \
policies=cert-manager-webhook-ovh-policy \
ttl=1h
Le secret n'est pas créé dans un namespace
Vérifiez que :
- Le
ClusterSecretStoreexiste et est valide - L'
ExternalSecretexiste dans le namespace concerné - Le ServiceAccount a les permissions nécessaires dans Vault
- Les credentials sont correctement stockés dans Vault
# Vérifier les logs d'External Secrets Operator
kubectl logs -n external-secrets-system -l app.kubernetes.io/name=external-secrets --context=cluster-ops --tail=50
# Vérifier les événements de l'ExternalSecret
kubectl describe externalsecret cert-manager-webhook-ovh -n cert-manager-ops --context=cluster-ops