You must rotate the database password used by 30 services without any downtime. How?

IntermediateScenarioSecurity incidents
Answer

Situation read → If you change the password in one step, every service using the old one fails until it reloads. You need a period where both work.

What I'd do →

  1. Use the two-user (alternating) pattern: app_a and app_b with identical grants. Services use one while the other is rotated.
  2. Store credentials in Secrets Manager; rotation updates the inactive user, then flips the secret to it.
  3. Services fetch the secret at runtime and reconnect on auth failure, or External Secrets refreshes the Kubernetes Secret and a reloader restarts pods with a rolling update.
metadata:
  annotations:
    reloader.stakater.com/auto: "true"
  1. The old user stays valid until the next rotation, so slow services still connect.
  2. Better long term: IAM database authentication (RDS) with short-lived tokens, so there's no static password at all.

Why → Overlapping validity is the only way to rotate without a synchronised restart of 30 services.

Interview tip → Name the alternating-users strategy; it's the one AWS's managed rotation uses.

All Real-World Interview questions Roadmap: Interview readiness

More on Security incidents