Read and write secrets using HashiCorp Vault KV v2

domain: developer.hashicorp.com · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Authenticate to Vault using an appropriate auth method (AppRole, Kubernetes, or AWS IAM) and obtain a client token; avoid using the root token in production
  2. Enable the KV v2 secrets engine at a chosen mount path if not already enabled: vault secrets enable -version=2 -path=YOUR_PATH kv
  3. Write a secret with vault kv put YOUR_PATH/secret-name key=value, or via the API with a POST to /v1/YOUR_PATH/data/secret-name with a JSON body containing a data object and optional options.cas for check-and-set
  4. Read the secret with vault kv get YOUR_PATH/secret-name or via GET to /v1/YOUR_PATH/data/secret-name; the actual values are nested under data.data in the API response
  5. List available secret names with vault kv list YOUR_PATH/ or GET to /v1/YOUR_PATH/metadata/; enumerate only what the calling identity's policy permits
  6. Rotate secrets by writing a new version; the previous version is retained and accessible by specifying the version query parameter; delete old versions explicitly when no longer needed

Known gotchas

Related routes

Sync Kubernetes secrets from HashiCorp Vault using External Secrets Operator
external-secrets.io/docs · 6 steps · unrated
Encrypt and rewrap secrets using HashiCorp Vault Transit secrets engine
developer.hashicorp.com · 6 steps · unrated
Inject Vault secrets into Kubernetes pods using the Vault Agent sidecar injector
developer.hashicorp.com/vault/docs/platform/k8s/injector · 6 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans