Skip to main content
In this guide, we’ll cover how to secure Kubernetes Secrets by encrypting them with Bitnami Sealed Secrets and manage them declaratively using FluxCD and Kustomize.

Table of Contents


1. Background: Plaintext Secret in Git

We have a FluxCD Kustomization that applies manifests from a Git repository:
Under ./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.
FluxCD’s Kustomize controller reconciles this Secret every 10 seconds, ensuring it’s present in the cluster.

2. Demonstrate Automatic Reconciliation

Verify the Secret and Pod exist:
Delete the Secret to see automatic re-creation:
FluxCD detects the drift and re-applies the manifest, recreating the Secret.

3. Suspend Reconciliation

Pause the Kustomization so FluxCD stops reconciling this directory:
Now, deleting the Secret will not trigger re-creation:

4. Trigger Pod Failure

Force a deployment restart to spawn a new Pod, which will fail due to the missing Secret:
Observe a CreateContainerConfigError:

5. Encrypt the Secret with kubeseal

Ensure you have:
  • The kubeseal CLI installed.
  • The Sealed Secrets public key (sealed-secrets.pub).
Encrypt the existing Secret manifest:
This creates a 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:
FluxCD applies the 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:
Decode and inspect the password:
Confirm the Pod is now running:

9. Conclusion

You have successfully:
  1. Suspended FluxCD reconciliation.
  2. Deleted a plaintext Secret and saw a Pod failure.
  3. Used kubeseal to create an encrypted SealedSecret.
  4. Committed the SealedSecret to your Git repo.
  5. Resumed FluxCD reconciliation and verified automatic decryption.
By integrating Bitnami Sealed Secrets with FluxCD and Kustomize, you can store encrypted secrets in Git, maintain GitOps workflows, and ensure secrets only decrypt inside your Kubernetes cluster.

Watch Video

Practice Lab