Configure External Secrets Operator to store Kubernetes secrets on the OVHcloud Secret Manager
Objective
This guide explains how to set up the Kubernetes External Secrets Operator to use the OVHcloud Secret Manager as a provider.
Warning
This guide describes how to use External Secrets Operator with the HashiCorp Vault provider to access the OVHcloud Secret Manager through the HashiCorp Vault KV2-compatible API.
OVHcloud now provides a native External Secrets Operator provider. We recommend using it for new deployments. See the OVHcloud provider documentation.
The user should be a member of a group with the ADMIN role. If you are using IAM policies instead, the user should have at least the following rights on the OKMS domain:
okms:apikms:secret/create
okms:apikms:secret/version/getData
okms:apikms:secret/get
okms:apiovh:secret/get
Alternatively, it's possible to create a user using OVHcloud CLI:
ovhcloud iam user create --login "secretmanager-b1033fdd-xxxx-xxxx-xxxx-xxxxxxxxx" --group ADMIN --description "A user create for Secret Manager, linked to xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx" --password "secretmanager-xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx" --email "secretmanager-xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx@ovhcloud.com"
Then create a Personal Acces Token (PAT) user_pat:
The PAT can be created with the OVHcloud CLI and the following command (fill in it with your own values):
ovhcloud iam user token create {user} --name pat-secretmanager-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx --description "PAT secret manager for domain xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx"
CLI will answer with the token value:
โ Token Secret-Manager created successfully, value: eyJhbGciOiJ...punpVAg
As an alternative, you can store directly the PAT in a environment variable:
PAT_TOKEN=$(ovhcloud iam user token create {user} --name pat-secretmanager-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx --description "PAT secret manager for domain secretmanager-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx" -j | jq .details.token | tr -d '"') ; echo $PAT_TOKEN
Keep the value of the token field as it will never be prompted again and will be used to authenticate to the Secret Manager as user_pat.
Secret Manager information
You will also need the region and the okms-id of the OKMS domain you want to use. This ID and this region can be found in the or via the OVHcloud CLI:
$ ovhcloud okms listโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโ id โ region โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโคโ xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx โ eu-west-par โโ xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx โ eu-west-par โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโ
Set up the Secret Provider in Kubernetes
Install the External Secrets Operator (ESO) on your Kubernetes cluster
$ kubectl get secret ovhcloud-vault-token -n external-secretsNAME TYPE DATA AGEovhcloud-vault-token Opaque 1 5m
Configure the External Secrets Operator
First, set up a ClusterSecretStore that is responsible of the synchronization with the Secret Manager.
We configure the SecretStore using HashiCorp Vault with token authentification and with the OKMS endpoint as backend.
Add the user_pat as a secret to be able to use it in the charts.
To define a new ClusterSecretStore resource, create a clustersecretstore.yaml file with the following content:
apiVersion: external-secrets.io/v1kind: ClusterSecretStoremetadata: name: vault-secret-storespec: provider: vault: server: "https://<region>.okms.ovh.net/api/<okms_id>" # OKMS endpoint, fill with the correct region and your okms_id path: "secret" version: "v2" auth: tokenSecretRef: name: ovhcloud-vault-token # The k8s secret that contain your PAT key: token namespace: external-secrets
$ kubectl get secret -n external-secretsNAME TYPE DATA AGE...ovhregistrycred kubernetes.io/dockerconfigjson 1 15m...
For any additional information on how to manage the External Secrets Operator, refer to the dedicated documentation, using the HashiCorp Vault provider: https://external-secrets.io/latest/.