-
Notifications
You must be signed in to change notification settings - Fork 393
[New] External Secret Operator with Secret Manager #8653
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 11 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
b4038db
First version of External Secret Operator documentation
gbarideau c41a3c4
adding info about authentification method supported
gbarideau 0d3d6bc
adding info about pushing secret not supported yet
gbarideau 36b3fd8
minor fix
gbarideau d11fd63
date update
gbarideau 08fccab
numerous fix following scraly comment
gbarideau 400ac30
indentation fix
gbarideau 2a2ab17
indentation fix
gbarideau c5d472c
moving SecretStore to ClusterSecretStore
gbarideau ddad50b
Documentation rework to support SecretStore instead of ClusterSecretS…
gbarideau ff6bb79
adding missing section about secret creation
gbarideau 5d3a23d
switching SecretStore for ClusterSecretStore
gbarideau 635cac5
adding possibility to store PAT as an environment variable
gbarideau 2fb08a7
applied suggested changes
gbarideau 86bad73
fix
gbarideau c4f11a4
Guides Team proofreading
Y0Coss File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
265 changes: 265 additions & 0 deletions
265
pages/manage_and_operate/secret_manager/external-secret-operator/guide.en-gb.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,265 @@ | ||
| --- | ||
| title: "Use Kubernetes External Secret Operator with Secret Manager" | ||
| excerpt: "Configure External Secret Operator to store Kubernetes secrets on the OVHcloud Secret Manager" | ||
| updated: 2025-11-07 | ||
| --- | ||
|
|
||
| > [!primary] | ||
| > Secret Manager is currently in Beta phase. This guide can be updated in the future with the advancements made by our teams in charge of this product. | ||
|
|
||
| ## Objective | ||
|
|
||
| This guide explains how to set up the Kubernetes External Secret Operator to use the OVHcloud Secret Manager as a provider. | ||
|
|
||
| ## Requirements | ||
|
|
||
| - An [OVHcloud customer account](/pages/account_and_service_management/account_information/ovhcloud-account-creation). | ||
| - Have [ordered an OKMS domain](/pages/manage_and_operate/kms/quick-start) or [created a first secret](/pages/manage_and_operate/secret_manager/secret-manager-ui). | ||
| - Have a Kubernetes cluster. | ||
|
|
||
| ## Instructions | ||
|
|
||
| ### Setup the Secret Manager | ||
|
|
||
| To allow access to the Secret Manager you will need to have a `token`, the `region` and `okms-id` of your Secret Manager. | ||
|
|
||
| #### Credential creation | ||
|
|
||
| Create an [IAM local user](/pages/account_and_service_management/account_information/ovhcloud-users-management) with access right on your domain. | ||
scraly marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| The user should be a member of a group with the ADMIN role, or if using [IAM policies](/pages/account_and_service_management/account_information/iam-policy-ui) to have at least the following rights on the OKMS domain: | ||
|
|
||
| - `okms:apikms:secret/create` | ||
| - `okms:apikms:secret/version/getData` | ||
| - `okms:apiovh:secret/get` | ||
|
|
||
| Then create a Personnal Acces Token (PAT) `user_pat`: | ||
|
|
||
| > [!tabs] | ||
| > API | ||
| >> > [!api] | ||
| >> > | ||
| >> > @api {v1} /me POST /me/identity/user/{user}/token | ||
| >> | ||
| >> With the following payload (fill with your values): | ||
| >> | ||
| >> ```json | ||
| >> { | ||
| >> "description": "PAT secret manager for domain xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx", | ||
| >> "name": "pat-secretmanager-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx" | ||
| >> } | ||
| >> ``` | ||
| >> | ||
| >> API will answer with: | ||
| >> | ||
| >> ```json | ||
| >> { | ||
| >> "creation": "2025-11-13T10:38:44.658926311Z", | ||
| >> "description": "PAT secret manager for domain xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx", | ||
| >> "expiresAt": null, | ||
| >> "lastUsed": null, | ||
| >> "name": "pat-secretmanager-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx", | ||
| >> "token": "eyJhbGciOiJ...punpVAg" | ||
| >> } | ||
| >> ``` | ||
| >> | ||
| > CLI | ||
| >> PAT can also created with the [OVHcloud CLI](https://github.com/ovh/ovhcloud-cli) and the command (fill with your values): | ||
| >> | ||
| >> ```bash | ||
| >> 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" | ||
gbarideau marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| >> ``` | ||
| >> | ||
| >> CLI will answer with the `token` value : | ||
| >> | ||
| >> ```bash | ||
| >> ✅ Token Secret-Manager created successfully, value: eyJhbGciOiJ...punpVAg | ||
| >> ``` | ||
|
|
||
| Keep safe the value of `token` field as it will never be prompt again and will be used to authenticate on the Secret Manager as `user_pat`. | ||
|
|
||
| #### Secret Manager info | ||
|
|
||
| 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 on the OVHcloud Control Panel. | ||
|
|
||
| Or through the [`ovhcloud` CLI](https://github.com/ovh/ovhcloud-cli): | ||
|
|
||
| ```bash | ||
| $ ovhcloud okms list | ||
| ┌──────────────────────────────────────┬─────────────┐ | ||
| │ id │ region │ | ||
| ├──────────────────────────────────────┼─────────────┤ | ||
| │ xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx │ eu-west-par │ | ||
| │ xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx │ eu-west-par │ | ||
| └──────────────────────────────────────┴─────────────┘ | ||
| ``` | ||
scraly marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ### Setup the Secret Provider in Kubernetes | ||
|
|
||
| #### Install the External Secret Operator on your kubernetes | ||
gbarideau marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```bash | ||
| helm repo add external-secrets https://charts.external-secrets.io | ||
| helm repo update | ||
|
|
||
| helm install external-secrets \ | ||
| external-secrets/external-secrets \ | ||
| -n external-secrets \ | ||
| --create-namespace \ | ||
| --set installCRDs=true | ||
| ``` | ||
|
|
||
| Check ESO is running: | ||
|
|
||
| ```bash | ||
| $ kubectl get all -n external-secrets | ||
| NAME READY STATUS RESTARTS AGE | ||
| pod/external-secrets-8cbc56569-9875p 1/1 Running 0 12s | ||
| pod/external-secrets-cert-controller-565fcd479b-xbkcp 0/1 Running 0 12s | ||
| pod/external-secrets-webhook-7fb59d4b88-9tkl6 0/1 Running 0 12s | ||
|
|
||
| NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE | ||
| service/external-secrets-webhook ClusterIP 10.3.43.102 <none> 443/TCP 13s | ||
|
|
||
| NAME READY UP-TO-DATE AVAILABLE AGE | ||
| deployment.apps/external-secrets 1/1 1 1 13s | ||
| deployment.apps/external-secrets-cert-controller 0/1 1 0 13s | ||
| deployment.apps/external-secrets-webhook 0/1 1 0 13s | ||
|
|
||
| NAME DESIRED CURRENT READY AGE | ||
| replicaset.apps/external-secrets-8cbc56569 1 1 1 13s | ||
| replicaset.apps/external-secrets-cert-controller-565fcd479b 1 1 0 13s | ||
| replicaset.apps/external-secrets-webhook-7fb59d4b88 1 1 0 13s | ||
| ``` | ||
|
|
||
| #### Create a secret containing the PAT | ||
|
|
||
| Start by encoding your `user_pat` is base64 so it can be stored in a kubernetes secret. | ||
gbarideau marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```bash | ||
| $ echo -n "<token>" | base64 | ||
gbarideau marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ZXlKaG...wVkFn | ||
| ``` | ||
|
|
||
| Then create a `secret.yaml`: | ||
gbarideau marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
gbarideau marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```yaml | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: ovhcloud-vault-token | ||
| namespace: external-secrets | ||
| data: | ||
| token: ZXlKaG...wVkFn | ||
| ``` | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Create the SealedSecret in your cluster:
gbarideau marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| And apply the ressource to the cluster: | ||
gbarideau marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```bash | ||
gbarideau marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| kubectl apply -f secret.yaml | ||
gbarideau marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ``` | ||
gbarideau marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| The secret should have been created: | ||
|
|
||
| ```bash | ||
| $ kubectl get secret ovhcloud-vault-token -n external-secrets | ||
| NAME TYPE DATA AGE | ||
| ovhcloud-vault-token Opaque 1 5m | ||
| ``` | ||
|
|
||
| #### Configure External Secret Operator | ||
|
|
||
| First, setup a `SecretStore` that is responsible of the synchronization with the Secret Manager. | ||
gbarideau marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 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 `SecretStore` resource, create a `secretstore.yaml` file with the followong content: | ||
|
|
||
| ```yaml | ||
| apiVersion: external-secrets.io/v1 | ||
| kind: SecretStore | ||
| metadata: | ||
| name: vault-secret-store | ||
| spec: | ||
| 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 | ||
scraly marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| key: token | ||
| ``` | ||
|
|
||
| > [!info] | ||
| > Only [token authentication](https://external-secrets.io/latest/provider/hashicorp-vault/#token-based-authentication) is supported | ||
|
|
||
| > [!info] | ||
| > This integration works with a `ClusterSecretStore` as well | ||
|
|
||
| Region name can be translated from your region location using: | ||
|
|
||
| > [!api] | ||
| > | ||
| > @api {v1} /location GET /location | ||
|
|
||
| As an example for **Europe (France - Paris)**, OKMS endpoint is **eu-west-par.okms.ovh.net** | ||
|
|
||
| Deploy the resource in your cluster: | ||
|
|
||
| ```bash | ||
| kubectl apply -f secretstore.yaml | ||
| ``` | ||
|
|
||
| #### Use External Secret Operator | ||
|
|
||
| Once the `SecretStore` is setup you can define `ExternalSecret` that comes from the secret manager. | ||
| Create a `externalsecret.yaml` file with this content: | ||
|
|
||
| ```yaml | ||
gbarideau marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| apiVersion: external-secrets.io/v1 | ||
| kind: ExternalSecret | ||
| metadata: | ||
| name: docker-config-secret | ||
| namespace: external-secrets | ||
| spec: | ||
| refreshInterval: 30m | ||
| secretStoreRef: | ||
| name: vault-secret-store | ||
| kind: ClusterSecretStore | ||
| target: | ||
| template: | ||
| type: kubernetes.io/dockerconfigjson | ||
| data: | ||
| .dockerconfigjson: "{{ .mysecret | toString }}" | ||
| name: ovhregistrycred | ||
| creationPolicy: Owner | ||
| data: | ||
| - secretKey: mysecret | ||
| remoteRef: | ||
| key: prod/va1/dockerconfigjson | ||
| ``` | ||
|
|
||
| Apply the resource in your cluster: | ||
|
|
||
gbarideau marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ```bash | ||
| kubectl apply -f externalsecret.yaml | ||
| ``` | ||
|
|
||
| It will create a Kubernetes Secret object. | ||
|
|
||
| ```bash | ||
| $ kubectl get secret -n external-secrets | ||
| NAME TYPE DATA AGE | ||
| ... | ||
| ovhregistrycred kubernetes.io/dockerconfigjson 1 15m | ||
| ... | ||
| ``` | ||
|
|
||
| For any additionnal informations on how to manage the External Secret Operator refer to the dedicated documentation, using the HashiCorp Vault provider: <https://external-secrets.io/latest/>. | ||
|
|
||
| ## Go further | ||
|
|
||
| Join our [community of users](/links/community). | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.