The External Secrets Enterprise Edition is product suite is a premium product.
It requires a specific subscription. Contact us for more information.
esi-cli without having direct access to Vault.
Scenario Overview
- Federation Server Cluster (
cluster-main): Hosts the ESI Federation Server and a Vault instance. Secrets are stored in Vault. - Client Cluster (
client-cluster-alpha): Hosts an application (Prometheus, in this example) that needs secrets fromcluster-main’s Vault.esi-cliwill be used to fetch these secrets.
Configuration Steps
1. On the Federation Server Cluster (cluster-main)
A. Install and Configure ESE:
Ensure External Secrets Enterprise Edition is installed and configured to act as a Federation Server. This typically involves enabling federation features in its deployment.
B. Set up ClusterSecretStore for Vault:
A ClusterSecretStore named vault-prod is configured to connect to the local Vault instance.
KubernetesFederation CR for the client cluster:
This CR registers client-cluster-alpha with the Federation Server.
kubectl apply -f kf-client-cluster-alpha.yaml
D. Create Authorization CR for the client’s Service Account:
This CR grants the prometheus-esi-client ServiceAccount from client-cluster-alpha permission to access the vault-prod ClusterSecretStore.
kubectl apply -f auth-allow-alpha-monitoring.yaml
2. On the Client Cluster (client-cluster-alpha)
A. Create the Service Account:
Ensure the prometheus-esi-client ServiceAccount exists in the monitoring namespace.
kubectl apply -f sa-prometheus-esi-client.yaml
B. Configure Application Pod to use esi-cli:
The Prometheus application pod will use esi-cli in an init container (or as the main container if Prometheus is launched by esi-cli) to fetch secrets before Prometheus starts.
Here’s an example snippet of a Pod manifest using esi-cli as an init container:
esi-cli invocation if esi-cli directly runs Prometheus:
Flow of Secret Retrieval
- The
prometheus-with-federated-secretspod starts onclient-cluster-alpha. - The
esi-initinit container (oresi-clias main process) starts, using theprometheus-esi-clientServiceAccount. esi-clisends its SA token (fromsystem:serviceaccount:monitoring:prometheus-esi-client) and its cluster’s CA cert tohttps://esi-federation.cluster-main.example.com.- The Federation Server on
cluster-mainvalidates the token using the JWKS fromhttps://kubeapi.client-alpha.example.com(derived from theKubernetesFederationCR). - The Federation Server checks the
AuthorizationCRallow-alpha-monitoring. It confirms thatsystem:serviceaccount:monitoring:prometheus-esi-clientfromclient-cluster-alpha(issuerhttps://kubernetes.default.svc.cluster.local) is allowed to accessvault-prod. - The Federation Server fetches the requested secret data (e.g.,
db-credentials.passwordorapi-keys.service-a-token) from itsvault-prodstore. - The secret data is returned to
esi-clionclient-cluster-alpha. esi-cliinjects the secrets as environment variables or files (e.g., setsMY_APP_DB_PASSWORDor writes to/etc/secrets/service-a.token).- The init container completes, and the main Prometheus container starts with the secrets available.
This setup successfully allows
client-cluster-alpha to consume secrets managed by cluster-main’s Vault instance without client-cluster-alpha (or its applications) needing any direct credentials or network access to Vault. The Federation Server acts as a secure intermediary.