Skip to content
Notifications
Clear all

How do you handle secret rotation for databases without app downtime?

3 Posts
3 Users
0 Reactions
2 Views
(@jasonh)
Estimable Member
Joined: 1 week ago
Posts: 97
Topic starter   [#16103]

I've been deep in the weeds of our credential management lifecycle this quarter, and one of the most persistent friction points remains rotating secrets for our production databases. We've been using HashiCorp Vault's database secrets engine for a while now, and while the *generation* of short-lived credentials is fantastic, the actual *rotation* of the underlying root or static user credentials—the ones our applications initially use to retrieve those short-lived creds—feels like we're always walking a tightrope.

The core dilemma, as I'm sure many of you have faced, is this: you have a critical database (say, PostgreSQL or MySQL) with a set of static credentials configured in Vault's database engine config. Rotating those credentials inherently means Vault itself loses its ability to connect to the database to generate new dynamic credentials. If you don't do this perfectly, applications can't fetch new credentials, leading to connection pool exhaustion and eventual downtime. We've scripted a process, but it feels brittle.

Our current multi-step approach looks something like this, and I'm keen to hear how others have improved upon it:

* **Create a new secondary user** with the same privileges as the primary Vault user, using a distinct username, before any rotation begins.
* **Update Vault's configuration** to use this new secondary user's credentials. This step must be quick and atomic where possible.
* **Only then, rotate/revoke the original primary user's credentials.** This ensures Vault never loses database connectivity.
* **Gradually recycle application pods or workers** so they pick up new dynamic leases issued using the new backend credentials.

The pain points we've identified:
* Coordination across platform and application teams to ensure recycle schedules are understood.
* Handling stateful applications or legacy systems that hold connections for very long periods.
* The sheer number of databases and engines (different types need slightly different scripts).

So, my question to the community: **What patterns or automation have you successfully implemented to make this process truly zero-downtime and, ideally, hands-off?** Are you using a GitOps workflow to manage the Vault config changes? Have you built a custom operator or leveraged Boundary in some way to gate these changes? I'm particularly interested in any real-world examples involving Kubernetes-based workloads and how you sequence the pod rotations.

~jason


~jason


   
Quote
(@aarons)
Estimable Member
Joined: 1 week ago
Posts: 80
 

We shifted away from the secondary user approach because it doubled our static credential footprint, which defeated the purpose. Our solution was to invest in a small, dedicated rotation service.

It handles the Vault config update and credential creation in the database atomically, using a circuit breaker pattern. If the new credentials fail to work with Vault, it rolls back automatically and alerts. This removed the manual tightrope walk.

The key for us was decoupling the rotation logic from both Vault and the database admin CLI. It's just another app, but it owns the risk. The cost was building and maintaining it, but it's cheaper than an outage.


Your cloud bill is 30% too high


   
ReplyQuote
 amym
(@amym)
Active Member
Joined: 1 week ago
Posts: 12
 

That's an interesting approach, building a separate service to own the atomic operation. I'm curious about how you manage the credentials for that rotation service itself. Doesn't it then become the new single point of failure? If its own access to both the database admin system and Vault is compromised, or if the service goes down, you're back to a manual process anyway. How do you secure and monitor that piece?



   
ReplyQuote