External secrets
bridges specialized secrets' stores (GCP Secret Manager
, AWS Secrets Manager
, Azure Key Vault
, etc.) and K8s generic Secret
concept. This allows you to write your code without relating to the specialized secrets stores and just use the generic K8s concepts instead; i.e. read secrets via mounted environment variables or config files.
If you run the full development services (via ArgoCD) or have manually installed the core development services, then external secrets
are already installed.
Alternatively you can manually install external secrets
via a single command as described below.
You need to have the
Helm
CLI installed on your system. Please refer to the basic tools documentation for installation instructrions: ../../1-basic-tools/README.md#helm
Navigate to the ./external-secrets-operator
folder and execute:
$ kubectl kustomize --enable-helm . | kubectl apply -f -
Configuring external secrets
consists of setting up two, main resources:
SecretStore
/ClusterSecretStore
. Thesecret store
configures the parameters of the external secret store (GCP Secret Manager
,Azure Key Vault
, etc.). This is a one time configuration job per secret store. See below for how to configureGCP Secret Manager
andAzure Key Vault
.ExternalSecret
. Theexternal secret
defines a specific secret to read from the external store and map to a K8Secret
in the cluster (so your modules can access it). This step is repeated for each individual (or group of) secret.
First we aquire the access credentials/service account to secret manager
and store them in a K8s secret
. Secondly, we define the ClusterSecretStore
manifest and reference the credentials from the K8s secret
.
- Get the GCP service account with read access (
secret accessor
) to the GCP Secret Manager (secrets). Download the account certificate (JSON). - Add the Json certificate to the
gcpsm.secret.yaml
secret manifest. - Add the secret to your local K8s:
$ kubectl apply -f ./gcpsm.secret.yaml
- Add the GCP project name to the
gcpsm-template.clustersecretstore.yaml
manifest. - Add the secret store manifest to your local K8s:
$ kubectl apply -f ./gcpsm-template.clustersecretstore.yaml
First we aquire the access credentials/service account to key vault
and store them in a K8s secret
. Secondly, we define the ClusterSecretStore
manifest and reference the credentials from the K8s secret
.
- Get the Azure service principal with read access to the Azure Key Vault.
- Add the client ID and client secret to the
azurekv.secret.yaml
secret manifest. - Add the secret to your local K8s:
$ kubectl apply -f ./azurekv.secret.yaml
- Add the Azure tenant ID and Vault URL to the
azurekv-template.clustersecretstore.yaml
manifest. - Add the secret store manifest to your local K8s:
$ kubectl apply -f ./azurekv-template.clustersecretstore.yaml
External secret manifest examples:
gcpsm-template.externalsecret.yaml
illustrates how to define a secret sourced fromGCP Secret Manager
.azurekv-template.externalsecret.yaml
illustrates how to define a secret sourced fromAzure Key Vault
.