Applying Sealed Secret in Kubernetes Cluster⚓︎
Learn to encrypt a Kubernetes Secret with Bitnami’s Sealed Secrets and apply it to your cluster while ensuring sensitive data remains secure.
In this guide, you’ll learn how to encrypt a Kubernetes Secret manifest with Bitnami’s Sealed Secrets, apply it to your cluster, and verify that it’s been decrypted back into a standard Secret. This workflow ensures sensitive data remains encrypted at rest and in version control.
Prerequisites⚓︎
- A running Kubernetes cluster
kubesealCLI installed- Bitnami Sealed Secrets controller deployed in the
kube-systemnamespace sealed-secret.yamlcontaining your Secret definition
1. Encrypt and Apply the SealedSecret⚓︎
First, seal (encrypt) your sealed-secret.yaml and then apply it:
kubeseal \
--controller-name my-release-sealed-secrets \
--controller-namespace kube-system \
--format yaml \
< sealed-secret.yaml \
| tee sealed-secret.yaml
You should see a confirmation:
Note
Make sure the --controller-name and --controller-namespace match your Sealed Secrets controller deployment.
2. Verify the Decrypted Kubernetes Secret⚓︎
Once the Sealed Secrets operator processes your SealedSecret, it will create a standard Secret. List all Secrets to confirm:
| NAME | TYPE | DATA | AGE |
|---|---|---|---|
| database | Opaque | 1 | 13h |
| sealed-secrets-keymnn78 | kubernetes.io/tls | 2 | 14h |
3. Inspect the Secret Manifest⚓︎
To view the full YAML of the decrypted Secret:
4. Decode the Secret Value⚓︎
Retrieve and decode your secret value directly:
Note
All data in a Kubernetes Secret is base64-encoded. Use -o jsonpath and base64 -d to decode sensitive values.
5. Monitor the Sealed Secrets Resource⚓︎
You can also inspect the status of your SealedSecret:
Name: database
Namespace: default
API Version: bitnami.com/v1alpha1
Kind: SealedSecret
Status:
ObservedGeneration: 1
Conditions:
- Type: Synced
Status: True
...
Ensure STATUS: True and SYNCED: True to confirm the operator successfully decrypted and created the Secret.