Short-lived secrets in Kubernetes: practical Vault patterns for rotation, auth, and delivery

Secrets that never change are the easiest attack surface to exploit. HashiCorp Vault gives engineering teams a way to move away from static credentials and toward short-lived, auditable secrets that rotate automatically — but adopting Vault safely inside Kubernetes requires deliberate choices: how secrets are issued, how workloads authenticate, and how secrets are delivered and renewed at runtime. This article lays out a practical pattern that balances security, availability, and operational simplicity, and calls out the key tradeoffs you’ll face.

Why short-lived (dynamic) secrets matter

Three integration patterns for Kubernetes workloads Vault supports multiple ways to deliver secrets into Kubernetes workloads. Choosing the right integration depends on whether you need live renewal, whether you want secrets persisted in Kubernetes objects, and how much application change you’ll accept.

Key guidance when selecting:

How workloads should authenticate Avoid baking Vault tokens into images or config. Kubernetes-native authentication using service account tokens validated by Vault’s JWT/OIDC authentication method gives a low-friction, tokenless bootstrap: Vault validates the pod’s service account token and maps it to a Vault role that has tightly-scoped policies. That makes pod identity manageable through Kubernetes RBAC and service account lifecycle instead of static Vault credentials. (docs.hashicorp.com)

Design principles for auth and policies:

Production hardening essentials Vault’s security and availability configuration matter as much as how you consume secrets. Production guidance includes strong audit logging, secure auto-unseal, HA storage, and operational controls.

A practical architecture pattern (example) Here’s a compact architecture that combines good practices for the common case: applications in Kubernetes needing short-lived DB credentials and runtime renewal.

Minimal Vault policy example A Vault policy should be as focused as possible. The example below grants a workload the ability to request dynamic DB creds from a single role only:

# policy.hcl
path "database/creds/app-role" {
  capabilities = ["read"]
}

When bound to a Vault role that is in turn mapped to a specific Kubernetes service account, this policy enforces that the workload only gets the credentials it needs and nothing more.

Operational tradeoffs and traps to avoid

Summary: make secret rotation operational Short-lived secrets are a powerful control for reducing risk, but they only help if your authentication, delivery, and operational controls align. Use Vault’s dynamic secrets engines for credential rotation, authenticate pods via Kubernetes OIDC/JWT rather than embedding tokens, pick the integration pattern (Agent, CSI, or Operator) that matches your renewal and persistence needs, and harden the Vault cluster with auto-unseal, HA storage, and audit logging. These choices turn Vault from a static secret store into an operational credential system that enforces rotation and least privilege at scale. (hashicorp.com)