Secrets management
Vault / cloud secret managers / external-secrets / sealed-secrets: rotation, dynamic credentials, and keeping secrets out of git, CI logs, and tfstate.
About 24 min read3-question knowledge check
The mental model
A hotel doesn't hand you the master key. It issues a card that opens one room, works until checkout, and can be cancelled from the front desk without re-keying the building. Bad secrets management is the master key taped under the doormat: one credential, shared by everyone, valid forever, and nobody knows who copied it.
Secrets management is about three properties, in increasing order of maturity:
- **Where the secret lives.** Not in git, not in a Dockerfile
ENV, not in a Jenkins job description. In a purpose-built store (HashiCorp Vault, AWS Secrets Manager, Azure Key Vault, GCP Secret Manager) that encrypts at rest, logs every read, and enforces access policy. - How the workload gets it. Ideally with no bootstrap secret at all — the workload proves what it is (an IAM role, a Kubernetes ServiceAccount token, an OIDC token from GitHub Actions) and receives the secret in exchange. This is the "secret zero" problem: if you need a password to fetch your passwords, you've moved the problem, not solved it. Identity-based auth removes secret zero.
- How long it lives. A static secret rotated yearly is a liability the day it leaks. A dynamic secret — Vault creating a fresh Postgres user with a 1-hour TTL for each pod — means a leaked credential is worthless by lunchtime, and revocation is automatic.
The three places secrets escape in practice are boringly consistent: git history, CI logs, and Terraform state. Every design decision below is aimed at one of those three.
The full lesson continues with 15 more sections
- Deep dive
- Internal architecture
- Real-world use cases
- Best practices
- Common mistakes
- Performance
- Security
- Production troubleshooting
- Advantages & disadvantages
- Alternatives
- Interview expectations
- Interview questions
- Facts to remember
- Cheat sheet
- Quick revision