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

The DB password was rotated in AWS Secrets Manager, the K8s Secret shows the new value, but the pods still use the old one

IntermediateTroubleshootingSecrets management: Vault, External Secrets and SOPS
Answer

Likely causes → The app reads the secret from environment variables. Env vars are fixed when the container starts and never refresh. Volume-mounted secrets do refresh, but only after the kubelet sync delay, and only if the app re-reads the file.

Diagnose →

kubectl get externalsecret db -o jsonpath='{.status.refreshTime}'
kubectl exec deploy/api -- printenv DB_PASSWORD | sha256sum
kubectl get secret db -o jsonpath='{.data.password}' | base64 -d | sha256sum

Fix → Roll the Deployment automatically when the Secret changes, for example with Stakater Reloader (reloader.stakater.com/auto: "true"), or mount the secret as a file and have the app watch it.

Prevent → Rotate in two phases: the old and new credentials both stay valid until every pod has restarted.

All DevSecOps questions Roadmap: Supply chain, secrets & identity

More on Secrets management: Vault, External Secrets and SOPS