When OpenBao KV v2 versioning matters for your secrets
Teams need KV v2 when application secrets change often enough that they need a history, a way to roll back a bad value, and protection against one writer silently overwriting another writer's change. OpenBao's key/value engine stores secrets encrypted before they reach storage, and the version matters for these needs. KV v1 keeps one current value per path. KV v2 keeps a version history for each secret, so an earlier value can be read back and restored, and it adds a metadata record that tracks version state. If your secrets are replaced but never need to be recovered, v1 may be enough. If an incident could require restoring a prior credential, plan for v2 before the first secret is written. The OpenBao overview is a useful starting point for the wider product.
Check-and-set is the control that matters when several pipelines, operators or automation jobs write the same path. In KV v2, a write can include a cas value that names the version the writer last read, and the write is refused if the current version has moved on. This turns a silent overwrite into an error the writer can handle. The cas_required setting, which you can apply per secret path through the metadata configuration, makes that check mandatory for every write. Confirm the exact request fields, the error returned on a mismatch and how cas_required is set in the KV v2 documentation for your release before you build a deployment process around them.
On non-dev servers, the v1 engine is the default when a key/value engine is mounted without a version, so the version must be chosen deliberately at mount time. Check which version each existing mount uses before you assume history exists for a path. Moving existing v1 data to v2 is a documented in-place upgrade, but it changes how the data is read and written, so your applications and pipelines may need updates as well. Confirm the steps for your OpenBao release in the official documentation, rehearse the upgrade on a copy of the cluster and record which clients depend on v1 paths and their current behavior.
How check-and-set writes prevent silent overwrites
Check-and-set turns a write into a compare-before-write step, so a change based on stale data fails instead of replacing newer data. The cards below cover how the guard behaves, the two-job case that makes it necessary, what clients must handle, and the controls that keep it in place.
Compare the version before writing
A check-and-set write sends the version the client last read along with the new data. OpenBao KV v2 stores the value only when the path's current version still matches that number, which confirms the client wrote against the latest state. Confirm the parameter name (cas) and how your client library or CLI sets it before automation depends on it.
Two jobs, one path
Consider two CI jobs that each read secret/app/config at version 7, change different keys, and write back (illustrative). Without a guard, the second write silently replaces the first, and version 8 loses the other job's change. List which pipelines write to each path before you grant write access, and treat shared paths as higher risk.
What the client receives on mismatch
When the expected version does not match, OpenBao rejects the write and stores nothing. The client receives an error instead of a success response, so the job must treat that as a failed write. Test this path in staging, because a script that ignores write errors will still appear to succeed.
Re-read, merge and retry
The correct response to a rejected write is to read the current version, reapply the intended change to the latest data, and write again with the new version number. Limit retries, log each conflict, and have the job stop and alert when the same conflict repeats. Retrying with the old data recreates the overwrite problem.
Require the guard on each mount
A check-and-set guard only protects paths whose writers use it. Ask whether your KV v2 mount can require the parameter on every write, so a script that omits it is refused. Confirm the setting name and behavior in the docs for your OpenBao version, and review write policies alongside it.
Trace conflicts through version history
Each successful write creates a new version, and older versions stay readable until your retention settings remove them. After a suspected conflict, compare versions and check audit logs to see which identity wrote each one. Confirm retention and audit configuration before an incident, so the evidence exists when you need it.
Choosing between a new v2 mount and an in-place v1 upgrade
When a cluster is new, or a secrets path has no data and no consumers yet, the team can create a versioned mount from the start. Nothing needs to be converted, so the work is mostly about naming, policy design and client conventions. Version history and check-and-set writes are available from the first secret, which makes later audit and rollback work simpler.
- Path layout: Decide mount names and path hierarchy before any application writes to them, since paths are the unit that policies and clients depend on.
- Client conventions: Write client code and templates against v2 paths, which include
data/andmetadata/segments. - Policy design: Grant read, write and metadata permissions separately so that teams can read current values without managing version history.
- Version limits: Confirm the maximum number of retained versions and the default delete behavior for your OpenBao release in the docs.
- Test writes: Run check-and-set writes in a non-production environment to confirm that your client libraries send the expected version field.
Before go-live, confirm the v2 engine options and defaults in the OpenBao migration guide and your release notes, then record the decisions in a short mount standard that the platform and application teams both sign.
A common middle case is an existing v1 mount that stays in service while a new v2 mount is created for new applications or teams. The old mount keeps serving current consumers unchanged, and migration of secrets happens on a schedule the owners agree to. This avoids changing paths that running services depend on, but it means two secret models operate side by side for some period.
- Two mount models: Document which teams use v1 and which use v2, so that operators do not assume one convention everywhere.
- Copy plan: Decide whether secrets are re-written into the new mount by the owning team or by a scripted process, and who checks the result.
- Access overlap: Review policies that grant access to both mounts, because a broad wildcard can expose secrets in the wrong model.
- Cutover record: Track each application's cutover date and rollback path in your change system.
- Audit coverage: Confirm that audit logs capture reads and writes on both mounts before the first cutover.
Before creating the second mount, confirm in the OpenBao docs how the two engines behave when a path is reused or moved, and whether any v1 behavior depends on paths your applications already read.
An in-place upgrade converts an existing v1 mount to v2 without moving its path. Clients keep the same mount, but the API surface changes: v2 paths add a data/ segment and reads return a wrapped response with version metadata. Any application, template, script or Helm value that builds a v1 path or parses a v1 response will break unless it is updated, so the inventory of consumers is the first deliverable.
- Consumer inventory: List every application, agent template, CI job and script that reads or writes the mount, including ones owned by other teams.
- Path and response review: Check each consumer for hard-coded v1 paths and for code that reads the response body directly.
- Staging rehearsal: Run the upgrade on a copy of the cluster with representative consumers, and confirm that reads, writes and listing still work.
- Change window: Schedule the conversion with consumer owners present, and agree who can reverse it.
- Rollback limits: Confirm in the docs whether the conversion can be reversed, and what state the mount is left in if it is only partly applied.
Before acting, confirm the documented in-place upgrade steps for your exact OpenBao version in the OpenBao migration guide and any version notes that apply to your release.
Some clusters still run a Vault server that has to move to OpenBao before any KV change is meaningful. The OpenBao migration guide describes in-place replacement of the server process on all nodes, with configuration, endpoints and URLs unchanged, and it was tested only against Vault 1.14.1 community edition. If the server move is still pending, the KV decision should wait so that only one variable changes at a time.
- Tested baseline: Confirm that your current Vault version and edition match the tested path in the guide, and treat Vault Enterprise as unverified by the guide.
- Pre-upgrade checks: Check whether the cluster was bootstrapped before Vault 1.3, since that may require a rekey first.
- Configuration cleanup: Remove
disable_mlockfrom configuration, because OpenBao stopped using mlock in 2.0.0. - Sequencing: Complete the server move and a stable soak period before converting any KV mount.
- Backups: Take and test a backup of storage before each change, since the KV conversion and the server move both touch stored data.
Before scheduling either change, confirm the rekey requirement, configuration changes and node-by-node order in the migration guide and against your own environment.
KV v1 versus KV v2 options and when each fits
This table compares KV v1 and KV v2 on version history, rollback, check-and-set writes, path layout, client changes and day-two overhead. Read each row as the question to answer before choosing a mount version for a team or workload. The main takeaway is that v2 adds recovery and safe-write options in exchange for changed paths and client code, so confirm your clients support the v2 path format before migrating.
| Area | KV v1 | KV v2 |
|---|---|---|
| Version history | Each write replaces the stored value. Earlier values are not kept by the engine. | Each write creates a numbered version of the secret that can be read later. |
| Rollback | Recovering an earlier value needs a copy kept outside OpenBao. | An earlier version can be read and written back as a new current version. |
| Check-and-set writes | Not available. Writes cannot be guarded against a concurrent change. | A write can include a check-and-set value so it succeeds only when the current version matches. |
| Path layout | The secret sits directly at the path, such as secret/app/db. | Reads and writes use data/ and metadata/ segments, such as secret/data/app/db and secret/metadata/app/db. |
| Client code changes | Existing scripts and clients that use the plain path keep working. | Clients must insert data/ into paths and read values from the data field of the response. |
| Operational overhead | Lower. Each path holds one value and there is no version history to govern. | Higher. Version limits, deletion, destruction and metadata need an owner and a retention rule. |
| Default on non-dev servers | Confirm the mount version in your configuration. The documented default on non-dev servers is v1. | Set the version explicitly when you enable a mount on a non-dev server to avoid relying on the default. |
| Default in dev mode | Not the default in dev mode. | Dev mode mounts a v2 engine at secret/, so examples written for dev may not match a production mount. |
Setting up a KV v2 mount and migrating a v1 path
This sequence moves existing key/value secrets onto a versioned KV v2 engine without losing data or breaking clients. Each step ends with a check the team can run before it moves on.
Confirm server version and mount types
The platform engineering team records the OpenBao version running on every node and lists all mounts with their engine types, so every KV v1 path is identified before anything changes. The migration guide was tested only against Vault 1.14.1 community edition, so if the cluster started as Vault, confirm with the migration guide that your starting point is covered. Done when you hold a written inventory of mount paths, engine types, owners and node versions, and every node reports the same version.
Enable or identify the KV v2 engine
Decide whether existing v1 data converts in place or moves to a new KV v2 mount at a new path. Confirm the exact procedure in the KV engine documentation for your version, because a new mount holds separate secrets from the v1 mount it replaces. Write a test secret to the target mount, read it back, and confirm that the write created version 1 with the expected data. Done when the test round trip succeeds and the mount type reads as KV v2 in the mount listing.
Back up existing secrets before upgrading
Take a snapshot or storage backup using the tooling for your backend (integrated storage, PostgreSQL or another documented option), and store it encrypted outside the cluster. Restore the backup into a non-production environment to prove it works, and confirm that secret paths and counts match the inventory from the first step. Keep the unseal keys or recovery material in a separate, controlled location. Done when a restore test completes and the restored environment returns the same secret paths you recorded.
Perform the documented in-place upgrade
Following the migration guide, replace the Vault server process on each node with the OpenBao binary while keeping configuration, endpoints and URLs unchanged. Remove disable_mlock from the configuration, because OpenBao stopped using mlock in 2.0.0. If the cluster was bootstrapped before Vault 1.3, plan a rekey as the guide describes. Upgrade one node at a time and confirm each node rejoins before moving to the next. Done when every node reports the target version, is unsealed, and passes its health check.
Update client paths and policies
KV v2 reads and writes use a data path, and version metadata lives under a separate metadata path, so client code, templates and agent configurations must point to the new endpoints. Update policies so that each consumer holds the capabilities it needs on both paths, and give read-only consumers no write rights. Identify any client still calling the v1 path, because those calls will fail after the change. Done when a test client using the updated policy reads and writes successfully and a client with the old path receives the expected error.
Verify reads, writes, versions and rollback
Write a test secret at least twice, then read the earlier version by number and confirm it returns the original data. Roll back to that version, read the current version, and confirm it now matches the restored data. Next, test check-and-set by writing with the current version number, which should succeed, then writing with a stale number, which should be rejected. Record the results as an acceptance record for the mount. Done when every read, write, version read, rollback and check-and-set test produces the expected result.
How a KV v2 read, write and rollback move through OpenBao
The diagram starts with a client outside the trust boundary sending a KV v2 write that includes a check-and-set version, so the write only succeeds if the secret is still at the version the client last read. OpenBao records the result as a new version in its encrypted storage. A read then asks for one specific version, and a rollback copies an earlier value forward as a new version rather than deleting history. Check that the client's expected version matches before writing and that rollback creates a new version.
Client writes, reads and rolls back KV v2 secrets across the OpenBao trust boundary.
Security risks that version history introduces
Versioning makes OpenBao KV v2 safer to operate, but every retained version is also data that someone can read. The cards below cover the access, audit and cleanup decisions to make before teams start writing secrets with history enabled.
Old versions stay readable
Writing a new version does not remove the previous ones. Until a version is deleted or destroyed, anyone whose policy allows reading that version can still retrieve the old value, including a password that was rotated last week. Confirm the max_versions setting on each mount and the retention behavior you want for superseded values before onboarding teams. Ask the vendor or your own test cluster how soft deletion and destruction differ for your chosen version.
Metadata and versions need separate policies
In KV v2, reading a secret's values, listing its versions and reading its metadata go through different API paths. A policy that grants data access does not automatically cover metadata, and the reverse is also true. Write separate rules for data/, metadata/, delete/, undelete/ and destroy/ paths, and test each one with a token that holds only the intended capability.
Limit who can read history
Read access to a secret path often implies access to every older version, which can hold credentials that are no longer valid but still reveal naming patterns, prior owners or policy structure. Restrict read capabilities on historical versions to the workloads and operators who need them. Review which human groups hold broad list or read rights on mounts that store shared service credentials.
Audit reads and writes
Audit devices record requests and responses to OpenBao, so reads and writes to secret versions should appear in the audit trail with the requesting identity. Confirm that at least one audit device is enabled, that log destinations are protected from tampering, and that your team can search by secret path and by identity. Test an audit query for a single version read before relying on it for an investigation.
Clean up rotated secrets in history
Rotating a secret by writing a new version does not invalidate the old value at the target system. The superseded version stays in history until someone destroys it, so a leaked old password can still be read from OpenBao. Decide which versions must be destroyed after rotation, whether the target system has revoked the old credential, and who runs the destroy call. Record that step in the rotation runbook.
Plan retention with compliance owners
How long old versions should exist depends on your recovery needs, audit expectations and data protection rules, and those answers differ by organization. Ask your compliance and security owners to define the retention period, the maximum version count and the destroy rules for each class of secret before the first production mount. Document the decision so later changes go through the same review.
Questions teams ask before upgrading KV v1 to v2
How much effort does upgrading KV v1 to v2 take?
The effort depends far more on how widely KV v1 is used than on the upgrade step itself. Teams should expect the work to scale with three drivers:
- The number of KV mounts and the number of secret paths under them.
- The number of applications, scripts, pipelines and operators that read or write those paths.
- The number of policies, templates and automation tools that reference the current path layout.
A small cluster with a few mounts and well-documented consumers is a contained job. A large estate with undocumented scripts usually spends most of its effort finding and updating those consumers. Ask any provider for a written inventory method and a test plan before agreeing on effort.
Can our in-house team upgrade KV v1 to v2 alone?
Yes, a capable in-house team can do this if it has hands-on OpenBao operations experience, a non-production cluster to rehearse on, and time to inventory every client. The team needs people who understand policy design, secret path conventions and the owners of each consuming application. The weakest point is usually the client inventory, not the server change. If the team lacks capacity or has no rehearsal environment, a partner can plan, implement and document the upgrade under a fixed-scope agreement, with the written scope setting deliverables and timelines before work starts.
What do we need to prepare before the upgrade starts?
Preparation needs three inputs from your side:
- A verified backup of the storage backend and the mounts being upgraded, taken and restored in a test environment first.
- An agreed maintenance window and a named change owner who can approve a rollback.
- A client inventory that lists every application, pipeline, script and operator that touches each KV path, with a contact for each.
Your security and platform teams should also confirm which policies reference the current paths. Keep the inventory in version control so it can be reviewed during the change and reused for later upgrades. Confirm the exact pre-upgrade steps against the OpenBao documentation for the version you run.
How long does the upgrade take and what changes the timing?
The duration is set by the size of the inventory, the number of consumers that need changes, and how many environments must pass testing before production. Timing also depends on whether your change process requires separate approvals, on the availability of application owners for testing, and on how quickly your team can run a restore rehearsal. Clusters with few mounts and clear ownership move faster. Ask for a timeline that lists each stage, the owner of each stage and the exit criteria, and confirm the exact sequence in the OpenBao documentation for your release.
Is upgrading from KV v1 to v2 reversible?
Treat the upgrade as reversible only to the extent the documentation and your tested restore procedure confirm. The practical safety net is a backup taken immediately before the change, plus a rehearsed restore in a separate environment. Before production, confirm which rollback steps the OpenBao documentation supports for your version and what happens to secrets written after the upgrade. Plan for a rollback window in which applications are paused or pointed back to the previous state. Record the decision criteria for rollback in the change plan so the owner does not decide under pressure.
Which clients and policies break when KV v2 paths change?
The most common failures come from clients and policies that assume the KV v1 path layout. KV v2 keeps secret data and metadata under separate path prefixes, so code that reads or writes a bare path, and policies that grant access to the old path only, can fail or grant unintended access. Check these areas first:
- Application code and configuration that calls the KV API directly.
- Agent templates, CI pipelines and infrastructure code that reads secrets.
- Policies that use wildcards, which may need separate rules for data and metadata.
Confirm the exact path and policy changes in the OpenBao documentation before writing new policies.
Who should own the KV v2 upgrade decision in our organization?
Ownership should sit with the team that runs the OpenBao cluster, with explicit sign-off from the security owner for the secret inventory and access model. Application owners need to confirm their consumers, because they know which paths and behaviors their code depends on. Assign one accountable change owner who approves the test results and the rollback criteria. After the upgrade, decide who maintains the inventory and who handles future version changes. If your organization has no retained support, a retainer can cover ongoing upgrades, testing and documentation after the one-time work is complete.
Limits to confirm in your OpenBao version
KV v2 behavior depends on the OpenBao line you run and the Vault version you started from. The items below are the checks to finish before you enable versioning or move an existing KV v1 mount, so that retention, upgrade scope and release changes are confirmed against sources rather than assumed.
In-place upgrade on your version
The migration guide describes replacing the Vault server process on all nodes while configuration, endpoints and URLs stay unchanged. Confirm that this path applies to the Vault version and OpenBao line you are moving between, and check whether your cluster was bootstrapped before Vault 1.3, which may require a rekey first. Record the exact sequence you will test, including the order of nodes and the rollback point. Also remove disable_mlock from configuration, because OpenBao stopped using mlock in 2.0.0.
Tested scope of the migration
The migration guide states it was tested only against Vault 1.14.1 community edition, not Vault Enterprise. If your source cluster runs a different Vault version, an Enterprise feature, or a different storage backend, treat the guide as a starting point and plan your own rehearsal on a copy of production data. Ask your team to write down which mounts, auth methods and plugins are in use so each one can be checked after the upgrade.
Tested versionsVersion-specific changes in release notes
Each minor line can change defaults, endpoints or plugin behavior that affects KV v2 reads, writes and metadata calls. Read the release notes for every version between your current release and your target, not only the latest one. Pay attention to the v2.7.x patch releases and to the previous minor line, since maintenance releases can land on either. Confirm which release you are actually running with a version command before comparing notes.
- Latest patch in supplied facts
- 2.7.1
Version history and retention settings
Versioned KV keeps old values until its configured limits remove them, and the default and per-secret settings depend on your version and how the mount was created. Check the maximum number of versions and any delete-after period on each mount, and decide whether soft-deleted versions must remain recoverable for your audit window. Confirm how the upgrade treats existing v1 secrets, because they do not gain a version history after conversion.
Destroy and delete behavior
Soft delete, undelete and permanent destroy are separate operations, and only destroy removes the underlying data for a version. Test each one on a non-production mount and confirm the policy paths your automation uses, since a policy that grants delete may not grant destroy. Record who holds each capability so a rollback or cleanup job does not remove history that your audit or incident response needs.
Client and policy compatibility
Applications, Agent templates and CI jobs may call the KV v2 data and metadata paths, and a path change after upgrade will break them silently. Inventory every client that reads from the mount, including Vault-compatible libraries, then confirm each one works against your OpenBao version in a staging environment. Review ACL policies for the data/ and metadata/ prefixes, because v2 policies differ from v1 ones.
How DeployOpen scopes and delivers KV v2 work
DeployOpen starts KV v2 work with a written, fixed scope that names the OpenBao clusters, the mounts to be converted or created, the teams that read and write secrets, and the deliverables. The scope also states what is excluded, such as application code changes, secret value rotation or work on other secrets engines. Before any mount is changed, the team inventories consumers and policies: which tokens, AppRoles and Kubernetes or JWT roles read paths under each KV mount, which paths use the data/ and metadata/ prefixes that KV v2 requires, and which clients call the API directly. Those paths are the main source of breakage during an upgrade from KV v1, because a v1 path such as secret/app/db does not match a v2 policy written for secret/data/app/db. Policy changes are reviewed against the inventory, not written from memory.
The upgrade itself is staged. DeployOpen recommends confirming the target OpenBao version against the OpenBao releases page and the migration guide before scheduling work, then running the change first in a non-production cluster that holds a copy of the mount layout. Validation covers read and write paths for each consumer role, check-and-set behavior for writes that depend on it, version history on sample secrets and the rollback path for a failed change. The production change should not proceed until every consumer role has passed its read and write checks in staging. The client keeps a dated record of each step, the policy diff and the test results.
Handover includes a runbook for the client's platform team covering the mount layout, the policy conventions for data/ and metadata/ paths, the version retention settings chosen for each mount and the steps for rollback and restore. Optional retainer support can cover policy changes as teams onboard, periodic review of version counts and retention, and upgrades to later OpenBao releases. Quotes should separate the one-time scoping, inventory and conversion work from any recurring support, and should list which client staff must be available for inventory interviews and approval windows. DeployOpen does not make outcome, certification or timeline commitments beyond what the written scope states.

