k8s

ADR-004: Use Sealed Secrets for GitOps Secret Management

Status

Accepted

Context

I needed a way to manage secrets in a GitOps workflow where:

Traditional approaches have limitations:

Decision

I adopted Bitnami Sealed Secrets for encrypting secrets that can be safely committed to Git.

How it works:

  1. Sealed Secrets controller runs in each cluster with a public/private key pair
  2. Developers use kubeseal CLI to encrypt secrets, producing SealedSecret CRs
  3. SealedSecret resources are committed to Git (encrypted, safe to store)
  4. Sealed Secrets controller watches for SealedSecret resources
  5. Controller decrypts and creates regular Kubernetes Secret resources
  6. Applications consume the decrypted Secret as normal

Key Features:

Usage Pattern:

# Encrypt a secret
kubectl create secret generic my-secret --dry-run=client -o yaml \
  | kubeseal -o yaml > sealed-my-secret.yaml

# Commit sealed-my-secret.yaml to Git
# Controller automatically creates my-secret in cluster

Consequences

Positive

Negative

Mitigations

Alternatives Considered

1. External Secrets Operator (ESO)

Rejected because:

2. HashiCorp Vault

Rejected because:

3. SOPS with age/PGP

Rejected because:

4. Cloud Secret Managers (AWS Secrets Manager, GCP Secret Manager)

Rejected because:

5. Plaintext in Git (with private repos)

Rejected because:

6. Kubernetes Secrets with External Encryption (e.g., KMS)

Rejected because:

Implementation Notes

Key Management Best Practices

References