Managing Secrets in GitOps
What you'll learn: How to safely store and manage sensitive credentials in GitOps workflows without exposing them in version control.
The GitOps Secrets Problem
GitOps stores your entire infrastructure configuration in Git repositories, which is fantastic for transparency and auditability. But there's a catch: you cannot commit passwords, API keys, or certificates in plain text to Git—even private repos get leaked, cloned by contractors, or exposed through misconfigurations.
Think of it like a restaurant keeping recipes in a public cookbook: you want everyone to see how to make the dish, but not where you hide the safe combination or credit card numbers.
Three Common Approaches
1. Encrypted Secrets in Git
Tools like Sealed Secrets (Kubernetes-specific) encrypt secrets before they enter Git. Only the cluster can decrypt them using a private key stored securely in the cluster itself. You commit the encrypted blob; Git sees gibberish, but your cluster reads the real value.
2. External Secret Management Integration
Instead of storing secrets in Git at all, you reference them from external vaults like HashiCorp Vault, AWS Secrets Manager, or Azure Key Vault. Your GitOps manifests contain pointers like vault://prod/db-password, and operators fetch the actual secret at runtime.
3. Placeholder Pattern
Some teams commit placeholder values (SECRET_PLACEHOLDER) and inject real secrets through CI/CD pipelines or admission controllers before deployment reaches the cluster.
Why This Matters
Without proper secret management, GitOps becomes a security liability instead of an asset. You need declarative automation and security—never trade one for the other.
Key Takeaway: GitOps demands encrypting secrets before committing them (like Sealed Secrets) or externalizing them entirely to dedicated secret stores, ensuring your Git repository remains safely public-readable while keeping credentials locked down.