Secret Management
This document describes how to keep passwords, client secrets and storage keys out of Helm values and CI variables. Sensitive values are stored in a Secret Manager, and the External Secrets Operator (ESO) syncs them into the Kubernetes Secrets that the workloads already read. A chart that supports the pattern renders ExternalSecret resources, which reference a SecretStore that already exists in the cluster.
The pattern is optional and disabled by default. Without it, the IAM secret-init job creates the in-cluster Secrets, and a Secret referenced by existingSecret can be created by any other process.
The charts support the pattern as follows:
- IAM: Renders
ExternalSecretresources for the Secrets listed underglobal.externalSecrets.files. See IAM External Secrets. - Platform API: Does not render
ExternalSecretresources. For S3-compatible storage, it reads the credentials from the Secret named byapi.storage.existingSecret, which can be synced by ESO or created manually. Azure Blob Storage and Azure Data Lake Storage Gen2 use Workload Identity and need no Secret. See Platform API Storage Configuration.
Note
The charts do not install ESO or Stakater Reloader, and they do not create the SecretStore or the cloud identity it uses. These must be provided by the cluster operator.
How It Works
- Sensitive values are stored in the Secret Manager. One remote secret per Kubernetes Secret is a workable default: a JSON payload whose property names match the Kubernetes keys fills all keys from one remote secret. In Azure Key Vault, each Kubernetes key can instead be stored as its own secret, in which case
remoteRef.propertyis omitted. - Each client namespace has its own
SecretStore, whose identity can read that client's secrets only. AClusterSecretStoreis used only for a platform-owned store that is meant to be shared. - The chart renders one
ExternalSecretper Secret listed underglobal.externalSecrets.files. Eachdataitem maps a Kubernetes key (secretKey) to a remote entry (remoteRef.key, plusremoteRef.propertyfor JSON payloads). - Workloads keep using
secretKeyRefandexistingSecretand never read the Secret Manager directly. Withglobal.externalSecrets.reloaderenabled (the default), IAM restarts consumers after an ordered config-cli import; see Rotation and Reloader.
| Parameter | Description | Default |
|---|---|---|
global.externalSecrets.enabled |
Render ExternalSecret resources. |
false |
global.externalSecrets.secretStore.name |
Name of the existing store. | - |
global.externalSecrets.secretStore.kind |
SecretStore for a store in the client namespace, or ClusterSecretStore. |
ClusterSecretStore |
global.externalSecrets.refreshInterval |
How often ESO re-reads the Secret Manager. | 1h |
global.externalSecrets.reloader |
Restart consumers after a Secret rotation (IAM: ordered import then restart; Reloader on Keycloak only). | true |
global.externalSecrets.files |
Map of Kubernetes Secret names to their data entries. |
{} |
Customer-Supplied Secrets
ESO is not required to keep values out of Helm. A Secret created by another process can be referenced directly:
- IAM: Consumers read
existingSecretand the CNPGsecretName.secret-initskips a name listed underfiles. The oauth2 and appsettings Secrets are the exception:secret-initcreates them only under the fixed names<release>-oauth2-secretand<release>-appsettings-secret, so a customexistingSecretfor either one has to exist before the pods start. - Platform API: S3-compatible storage reads
api.storage.existingSecret. When it is set,usernameandpasswordare not placed in the pod spec.api.storage.urlis still required.
When ESO manages a Secret, the matching Helm value must be removed. The IAM chart fails to render when both are set. See Render checks.
Naming
Remote secret IDs follow this pattern:
<client>-<env>-<module>-<secret>
| Part | Meaning | Example |
|---|---|---|
client |
Client or tenant slug | acme |
env |
Environment | prod |
module |
Module that consumes the secret | iam |
secret |
Logical secret inside that module | oauth2 |
Example: acme-prod-iam-oauth2. The charts do not build remote IDs, so the full ID is written in each remoteRef.key.
Client Isolation
Each client namespace uses its own namespaced SecretStore, backed by an identity that can read only that client's prefix or vault. A ClusterSecretStore is the exception, reserved for platform-owned stores shared by many namespaces, and is not used for client data.
Values for Google Cloud, Azure and OpenShift are in Cloud Provider Examples.
Google Cloud
On Rcloud, the Secret Manager is GCP Secret Manager. On GKE, the metadata server supplies the cluster project, name and location, so these fields are omitted below. Clusters outside GKE need the workload identity federation fields described in the External Secrets Operator Google Secret Manager guide.
apiVersion: external-secrets.io/v1
kind: SecretStore
metadata:
name: client-a-store
namespace: client-a
spec:
provider:
gcpsm:
projectID: client-a-secrets
auth:
workloadIdentity:
serviceAccountRef:
name: external-secrets
The identity is granted roles/secretmanager.secretAccessor only on secrets whose names start with the client prefix, e.g. acme-prod-. When clients share a project, an identity with project-wide access could read the secrets of every client.
Azure
Azure Key Vault uses the azurekv provider. The identity behind serviceAccountRef needs read access to the vault, e.g. the Key Vault Secrets User role, and a federated credential whose subject is the ESO service account. The module charts do not create this binding. See the External Secrets Operator Azure Key Vault guide for the Workload Identity setup.
apiVersion: external-secrets.io/v1
kind: SecretStore
metadata:
name: client-a-store
namespace: client-a
spec:
provider:
azurekv:
authType: WorkloadIdentity
vaultUrl: "https://client-a.vault.azure.net"
serviceAccountRef:
name: external-secrets
remoteRef.key is the Key Vault secret name. remoteRef.property is set only when the secret is a JSON object and a single property should become the Kubernetes key.
OpenShift
OpenShift uses the same ExternalSecret resources, with a SecretStore pointing at a Secret Manager that the cluster can reach. The IAM chart does not use a different secret controller on OpenShift. Edge routing on OpenShift is described in Auth gateway and Cloud Provider Examples.
Rotation
- Write the new value to the Secret Manager, keeping the same secret ID and JSON property names.
-
Wait for the
refreshIntervalto pass, or force a sync:kubectl annotate externalsecret <name> -n <namespace> force-sync="$(date +%s)" --overwrite -
Restart workloads that read the Secret through environment variables, unless Reloader restarts them. Mounted Secrets are updated on disk, but environment variables keep the previous value until the container restarts.
- Check the module documentation when a value is also copied elsewhere. In IAM, the config-cli import copies values into Keycloak, and a change to the Kubernetes Secret does not update that copy. See What still restarts or re-imports.