Secrets Management in Flux
What You'll Learn
You'll learn how to safely encrypt sensitive data in Git repositories using Mozilla SOPS, Sealed Secrets, and external secrets operators, enabling true GitOps without exposing credentials.
The GitOps Secret Dilemma
Flux embraces Git as the single source of truth, but storing plain-text secrets (database passwords, API keys) in Git is catastrophically insecure. The challenge: how do you version-control everything while keeping secrets encrypted until they reach the cluster?
Three Battle-Tested Solutions
Mozilla SOPS encrypts YAML/JSON files with keys from AWS KMS, Azure Key Vault, or GCP KMS. You commit encrypted files to Git; Flux's Kustomize Controller decrypts them at apply-time using configured credentials. It's like a lockbox where only your cluster holds the key.
Sealed Secrets uses asymmetric cryptography: you encrypt secrets with a public key (safe to commit), and only the cluster's SealedSecret controller holds the private key for decryption. Think of it as sealing an envelope that only one mailbox can open.
External Secrets Operator doesn't store secrets in Git at all—it synchronizes them from external vaults (AWS Secrets Manager, HashiCorp Vault) into Kubernetes secrets. Your Git repo contains references, not actual values.
Integration with Flux
Flux detects encrypted Secret resources in your reconciliation path. When using SOPS, you configure a decryption key in your Kustomization resource. For Sealed Secrets, you commit SealedSecret CRDs that get automatically converted. With External Secrets Operator, you deploy ExternalSecret CRDs that Flux monitors like any other resource.
All three approaches maintain GitOps principles: declarative, versioned, auditable—without security compromise.
Key Takeaway:
Flux supports multiple secrets encryption strategies (SOPS, Sealed Secrets, External Secrets Operator) that let you safely store encrypted or referenced secrets in Git while maintaining true GitOps workflows.