Table of Contents
1. Background: Plaintext Secret in Git
We have a FluxCDKustomization that applies manifests from a Git repository:
./database/secret-mysql.yaml, the MySQL password is stored in plaintext:
Storing passwords or tokens in plaintext within Git exposes them to unauthorized access. Always encrypt sensitive data before committing.
2. Demonstrate Automatic Reconciliation
Verify the Secret and Pod exist:3. Suspend Reconciliation
Pause theKustomization so FluxCD stops reconciling this directory:
4. Trigger Pod Failure
Force a deployment restart to spawn a new Pod, which will fail due to the missing Secret:CreateContainerConfigError:
5. Encrypt the Secret with kubeseal
Ensure you have:- The
kubesealCLI installed. - The Sealed Secrets public key (
sealed-secrets.pub).
SealedSecret resource:
Only the Secret’s values are encrypted. The keys (
password) stay in cleartext for mapping.6. Replace the Plaintext Secret
Backup the original manifest and commit the sealed version:7. Resume Reconciliation
Sync your Git source and resume the Kustomization:SealedSecret, and the Bitnami controller decrypts it into a normal Kubernetes Secret in database.
8. Verify the Decrypted Secret
Check that the Secret has been created:9. Conclusion
You have successfully:- Suspended FluxCD reconciliation.
- Deleted a plaintext Secret and saw a Pod failure.
- Used
kubesealto create an encryptedSealedSecret. - Committed the
SealedSecretto your Git repo. - Resumed FluxCD reconciliation and verified automatic decryption.
Links and References
- Bitnami Sealed Secrets GitHub
- FluxCD Kustomization Documentation
- Kustomize Tooling
- Kubernetes Secrets