Interview Prep/DevSecOps/Secrets management: Vault, External Secrets and SOPS

An app using Vault dynamic database credentials starts failing with `password authentication failed for user "v-kubernetes-api-x7f..."` after a few hours

IntermediateTroubleshootingSecrets management: Vault, External Secrets and SOPS
Answer

Likely causes → The lease hit its max_ttl and Vault revoked the DB user, but the app only read the credentials once at startup. Or the agent renewed the lease but the app's connection pool kept stale credentials.

Diagnose →

vault read database/roles/api            # default_ttl, max_ttl
vault list sys/leases/lookup/database/creds/api

Fix → Have Vault Agent re-render the credentials file and signal the app (exec with restart_on_secret_changes), or let the app re-read credentials and rebuild the pool. Make max_ttl longer than the longest pod lifetime, or restart pods well before it.

Prevent → Load-test credential rotation in staging with a short max_ttl such as 10 minutes.

All DevSecOps questions Roadmap: Supply chain, secrets & identity

More on Secrets management: Vault, External Secrets and SOPS