-
Notifications
You must be signed in to change notification settings - Fork 286
ADD userguide/managingApp/secret-management #6412
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
khanhtc1202
merged 3 commits into
pipe-cd:master
from
rahulshendre:userguide/managingApp/secret-management
Jan 22, 2026
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
There are no files selected for viewing
114 changes: 114 additions & 0 deletions
114
docs/content/en/docs-v1.0.x/user-guide/managing-application/secret-management.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,114 @@ | ||
| --- | ||
| title: "Secret management" | ||
| linkTitle: "Secret management" | ||
| weight: 9 | ||
| description: > | ||
| Storing secrets safely in the Git repository. | ||
| --- | ||
|
|
||
| GitOps workflows use Git as the single source of truth for application configurations. Storing sensitive data such as credentials, API keys, and secrets directly in Git repositories poses security risks. | ||
|
|
||
| PipeCD's secret management feature allows you to store encrypted secrets in your Git repository alongside application manifests. The encrypted secrets are decrypted by `piped` during deployment operations. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| Before using this feature, `piped` needs to be started with a key pair for secret encryption. | ||
|
|
||
| You can use the following command to generate a key pair: | ||
|
|
||
| ``` console | ||
| openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048 -out private-key | ||
| openssl pkey -in private-key -pubout -out public-key | ||
| ``` | ||
|
|
||
| Then specify them while [installing](../../../installation/install-piped/installing-on-kubernetes) `piped` with these options: | ||
|
|
||
| ``` console | ||
| --set-file secret.data.secret-public-key=PATH_TO_PUBLIC_KEY_FILE \ | ||
| --set-file secret.data.secret-private-key=PATH_TO_PRIVATE_KEY_FILE | ||
| ``` | ||
|
|
||
| Finally, enable this feature in the Piped configuration file with the `secretManagement` field as below: | ||
|
|
||
| ``` yaml | ||
| apiVersion: pipecd.dev/v1beta1 | ||
| kind: Piped | ||
| spec: | ||
| pipedID: your-piped-id | ||
| ... | ||
| secretManagement: | ||
| type: KEY_PAIR | ||
| config: | ||
| privateKeyFile: /etc/piped-secret/secret-private-key | ||
| publicKeyFile: /etc/piped-secret/secret-public-key | ||
| ``` | ||
|
|
||
| ## How it works | ||
|
|
||
| The secret management workflow is as follows: | ||
|
|
||
| - Encrypt secret data using PipeCD's Web UI and store the encrypted data in Git | ||
| - `piped` automatically decrypts the encrypted secrets before performing deployment tasks | ||
|
|
||
| ## Encrypting secret data | ||
|
|
||
| To encrypt secret data, navigate to the Applications page and click the "Encrypt Secret" button located in the top-left corner. Then, select a piped from the dropdown list, enter your secret data, and click the "ENCRYPT" button. | ||
| Copy the encrypted data to store in Git. | ||
|
|
||
|  | ||
| <p style="text-align: center;"> | ||
| Applications page | ||
| </p> | ||
|
|
||
| <br> | ||
|
|
||
|  | ||
| <p style="text-align: center;"> | ||
| The form for encrypting secret data | ||
| </p> | ||
|
|
||
| ## Storing encrypted secrets in Git | ||
|
|
||
| To make encrypted secrets available to an application, specify them in the application configuration file. | ||
|
|
||
| - `encryptedSecrets` contains a list of the encrypted secrets. | ||
| - `decryptionTargets` contains a list of files that use one of the encrypted secrets and should be decrypted by `piped`. | ||
|
|
||
| ``` yaml | ||
| apiVersion: pipecd.dev/v1beta1 | ||
| # One of Piped defined app, for example: using the Kubernetes plugin | ||
| kind: Application | ||
| spec: | ||
| encryption: | ||
| encryptedSecrets: | ||
| password: encrypted-data | ||
| decryptionTargets: | ||
| - secret.yaml | ||
| ``` | ||
|
|
||
| ## Accessing encrypted secrets | ||
|
|
||
| Any file in the application directory can use the `.encryptedSecrets` context to access secrets you have encrypted and stored in the application configuration. | ||
|
|
||
| For example: | ||
|
|
||
| - Accessing by a Kubernetes Secret manifest | ||
|
|
||
| ``` yaml | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: simple-sealed-secret | ||
| data: | ||
| password: "{{ .encryptedSecrets.password }}" | ||
| ``` | ||
|
|
||
| In all cases, `piped` decrypts the encrypted secrets and renders the decryption target files before using them to handle any deployment tasks. | ||
|
|
||
| <!-- ## Examples | ||
|
eeshaanSA marked this conversation as resolved.
|
||
|
|
||
| - [examples/kubernetes/secret-management](https://github.com/pipe-cd/examples/tree/master/kubernetes/secret-management) | ||
| - [examples/cloudrun/secret-management](https://github.com/pipe-cd/examples/tree/master/cloudrun/secret-management) | ||
| - [examples/terraform/secret-management](https://github.com/pipe-cd/examples/tree/master/terraform/secret-management) | ||
|
rahulshendre marked this conversation as resolved.
|
||
| - [examples/ecs/secret-management](https://github.com/pipe-cd/examples/tree/master/ecs/secret-management) --> | ||
|
|
||
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.