-
Notifications
You must be signed in to change notification settings - Fork 384
[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
base: develop
Are you sure you want to change the base?
Changes from 5 commits
b4038db
c41a3c4
0d3d6bc
36b3fd8
d11fd63
08fccab
400ac30
2a2ab17
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,250 @@ | ||||||
| --- | ||||||
| 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 advances of our teams in charge of this product. | ||||||
|
|
||||||
| ## Objective | ||||||
|
|
||||||
| This guide explains how 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). | ||||||
|
|
||||||
gbarideau marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| ## Instructions | ||||||
|
|
||||||
| ### Setup the Secret Manager | ||||||
|
|
||||||
| To allow access to the Secret Manager you will need to create credentials. | ||||||
|
|
||||||
| Create an [IAM local user](/pages/account_and_service_management/account_information/ovhcloud-users-management) with acces right on your domain. | ||||||
gbarideau marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| This user need to have at least the following rights: | ||||||
|
|
||||||
| - `okms:apikms:secret/create` | ||||||
| - `okms:apikms:secret/version/getData` | ||||||
| - `okms:apiovh:secret/get` | ||||||
| - `okms:apikms:secret/create` | ||||||
gbarideau marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
|
|
||||||
| Then create a Personnal Acces Token (PAT) `user_pat`: | ||||||
|
|
||||||
| > [!api] | ||||||
| > | ||||||
| > @api {v1} /me POST /me/identity/user/{user}/token | ||||||
gbarideau marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
|
||||||
| You will also need the `okms-id` of the OKMS domain you want to use. This ID can be found on the OVHcloud Control Panel. | ||||||
|
|
||||||
| ### Setup Sealed Secret | ||||||
|
||||||
|
|
||||||
| Sealed Secret allows you to safely store Kubernetes Secrets wherever you want by encrypting them. | ||||||
| This step is optionnal but highly recommendated. | ||||||
|
|
||||||
| First, install the controller in your cluster. It will automatically decrypt Sealed Secrets into standard Kubernetes Secrets | ||||||
|
|
||||||
| ```bash | ||||||
| helm repo add sealed-secrets https://bitnami-labs.github.io/sealed-secrets | ||||||
| helm install sealed-secrets -n kube-system sealed-secrets/sealed-secrets | ||||||
| ``` | ||||||
|
|
||||||
| Then, install kubeseal cli to encrypt Secrets into Sealed Secrets | ||||||
|
|
||||||
| ```bash | ||||||
| KUBESEAL_VERSION='' # Set this to, for example, KUBESEAL_VERSION='0.23.0' | ||||||
| curl -OL "https://github.com/bitnami-labs/sealed-secrets/releases/download/v${KUBESEAL_VERSION:?}/kubeseal-${KUBESEAL_VERSION:?}-linux-amd64.tar.gz" | ||||||
| tar -xvzf kubeseal-${KUBESEAL_VERSION:?}-linux-amd64.tar.gz kubeseal | ||||||
| sudo install -m 755 kubeseal /usr/local/bin/kubeseal | ||||||
| ``` | ||||||
|
|
||||||
| #### Usage | ||||||
gbarideau marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
|
|
||||||
| - Create your Sealed Secret | ||||||
|
|
||||||
| ```bash | ||||||
| kubeseal -f <secret-file> \ | ||||||
| -w <sealedsecret-output-file> \ | ||||||
| --controller-name=sealed-secrets \ | ||||||
| --controller-namespace=kube-system | ||||||
|
|
||||||
| kubectl create -f <sealedsecret-output-file> | ||||||
|
|
||||||
| # Check if you have access to your original Secret | ||||||
| kubectl get secrets <your-secret-name> -o yaml | ||||||
| ``` | ||||||
|
|
||||||
| You can now delete `secret-file` and use `sealedsecret-output-file` instead for a more secure storage | ||||||
|
|
||||||
| - Delete your Sealed Secret | ||||||
|
|
||||||
| ```bash | ||||||
| kubectl delete sealedsecret <your-sealedsecret-name> | ||||||
| ``` | ||||||
|
|
||||||
| #### Example | ||||||
|
|
||||||
| ```bash | ||||||
| $ cat secret.yaml | ||||||
| apiVersion: v1 | ||||||
| kind: Secret | ||||||
| metadata: | ||||||
| name: secret | ||||||
| type: Opaque | ||||||
| data: | ||||||
| value: TVkgQkFTRTY0IEVOQ09ERUQgU0VDUkVUIFZBTFVF | ||||||
|
||||||
|
|
||||||
| $ kubeseal -f secret.yaml \ | ||||||
| -w sealed-secret.yaml \ | ||||||
| --controller-name=sealed-secrets \ | ||||||
| --controller-namespace=kube-system | ||||||
|
|
||||||
| $ cat sealed-secret.yaml | ||||||
| --- | ||||||
| apiVersion: bitnami.com/v1alpha1 | ||||||
| kind: SealedSecret | ||||||
| metadata: | ||||||
| name: secret | ||||||
| namespace: default | ||||||
| spec: | ||||||
| encryptedData: | ||||||
| value: AgBLSGW9eG8Lc0HbToTM884euTNp49M6AkauFadPI8GwKe/lfSEmLr16HEQnh7DPb7T8OgL3d7qMRucEWO2TSppxsoXS5whKDaX7XA+d5tLSPZR6TCgI+ZWYBCYcerp8fM3gkzixM4wlyxAevqsWPxazGNQM4eYBv0YFZ+kaffkougHjG5uLwuX1IWGE8pFMf5XszkXu3MoFtmf2lbop+2qEtS3Wr4k/ueL92dY3ZmP1ZHSXWgvnNfZ30H1t+4pn9K+ddlJrajC/8TVT811WylyISd7EG6HaO8ayNRDErsu/JjsworJBKdj1vMIsdE+0ZQFg1MmCKp0zWU0Xjp90cEhSXuq9eqp4A8pofZ6D5n7ERr4jmznb41WWHRcKj2BdZBsOBUlP/J7P2Ymseet8+8od1HX0XQOv1CEnLHF6GMNAFZ7aQckuUIwKMx+zEHT6qVNBbtNe2B1OP1ApwRUw6lEdP5AnToi/mNt3ilypuTwXMqVGbHJzNMUrQRhfDItPALpDknCIcu1j1QsQRFIrdQ0Gfheg+QIzYJKVErWCRGR9zEUkqsMcxM7ruEc5U1GAgYyfLvXkczxzUG2WXf5mszKWyfcnQfCwmNdF/WKsufeJI0FaVQaWpkgX2cvTSd0281rKLvwEv0NRBVJkZ0lL1mzoZMXzXP5uWyk0E9SCHwM261ZkvqLsxnpKVA2QDZ4SuMBvl2fdIle5WVO/U1sl1eRAK1BVEWg8pYE7mTE7cXE= | ||||||
| template: | ||||||
| metadata: | ||||||
| name: secret | ||||||
| namespace: default | ||||||
| type: Opaque | ||||||
|
|
||||||
| $ kubectl create -f sealed-secret.yaml | ||||||
| sealedsecret.bitnami.com/secret created | ||||||
|
|
||||||
| $ kubectl get secrets secret -o yaml | ||||||
| apiVersion: v1 | ||||||
| data: | ||||||
| value: TVkgQkFTRTY0IEVOQ09ERUQgU0VDUkVUIFZBTFVF | ||||||
| kind: Secret | ||||||
| metadata: | ||||||
| creationTimestamp: "2025-10-13T12:37:25Z" | ||||||
| name: secret | ||||||
| namespace: default | ||||||
| ownerReferences: | ||||||
| - apiVersion: bitnami.com/v1alpha1 | ||||||
| controller: true | ||||||
| kind: SealedSecret | ||||||
| name: secret | ||||||
| uid: c3a8489f-8125-406b-8a3a-f99b82d432e1 | ||||||
| resourceVersion: "16156798047" | ||||||
| uid: f3fbfd60-46d7-4211-a9b1-e67d452bc7dc | ||||||
| type: Opaque | ||||||
| ``` | ||||||
|
|
||||||
| More information: (<https://github.com/bitnami-labs/sealed-secrets>) | ||||||
|
|
||||||
| ### Setup the Secret Provider in Kubernetes | ||||||
|
|
||||||
| #### Install the External Secret Operator on your kubernetes | ||||||
|
|
||||||
| ```bash | ||||||
| helm repo add external-secrets https://charts.external-secrets.io | ||||||
gbarideau marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
|
||||||
| helm install external-secrets \ | ||||||
| external-secrets/external-secrets \ | ||||||
| -n external-secrets \ | ||||||
| --create-namespace \ | ||||||
| --set installCRDs=true | ||||||
|
||||||
| ``` | ||||||
|
|
||||||
| #### Configure External Secret Operator | ||||||
|
|
||||||
| First, setup a `SecretStore` 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. | ||||||
|
|
||||||
| ```yaml | ||||||
| --- | ||||||
| apiVersion: bitnami.com/v1alpha1 | ||||||
| kind: SealedSecret | ||||||
| metadata: | ||||||
| name: token-secret | ||||||
gbarideau marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| namespace: default | ||||||
|
||||||
| namespace: default | |
| namespace: default |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
il n'est pas conseillé de mettre des ressources perso dans le namespace default.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| name: vault-secret-store | |
| name: vault-secret-store |
gbarideau marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment connaitre le nom de sa region alors que dans le manager elle est ecrit comme cela "Europe (France ) Paris" ?
la region il faut l'ecrire en minuscule, majuscule ? Liste predefinie ?
On a un moyen d'obtenir son OKMS endpoint de maniere simple ? :)
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| name: token-secret # The k8s secret that contain your PAT | |
| name: token-secret # The k8s secret that contain your PAT |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| key: token | |
| key: token |
Uh oh!
There was an error while loading. Please reload this page.