HashiCorp Vault
A central secrets platform with identity-based auth, dynamic credentials, encryption as a service and detailed audit logs.
Advanced · about 7 hours · difficulty 4/5
Learn first: Secrets Management Fundamentals
Vault (and its open-source fork OpenBao) goes beyond storing key-value pairs: it issues credentials on demand, encrypts data for applications and records every access.
Core concepts
- Seal and unseal: Vault starts sealed; its master key is split (Shamir) or held by a cloud KMS (auto-unseal).
- Auth methods prove identity: Kubernetes service accounts, cloud IAM, OIDC for humans, AppRole for machines.
- Policies in HCL grant paths and capabilities (
read,create,list). Default deny. - Tokens carry policies and a TTL; everything expires unless renewed.
- Audit devices log every request and response (with secrets hashed).
Secrets engines
- KV v2: versioned static secrets.
- Database: creates a unique database user per request with a short lease, then drops it. No shared passwords.
- Cloud engines (AWS, Azure, GCP) issue short-lived cloud credentials.
- PKI: an internal certificate authority issuing short-lived TLS certificates.
- Transit: encryption as a service; apps send plaintext and get ciphertext without ever holding the key.
Getting secrets into workloads
The Vault Agent sidecar or injector writes secrets to files and renews them; the Secrets Store CSI driver or External Secrets Operator syncs them into Kubernetes; apps can also call the API directly.
Running it
Run at least three nodes with integrated Raft storage, enable auto-unseal, back up snapshots, and treat the root token as break-glass only.
Good enough to move on: you can run Vault in dev mode, authenticate a Kubernetes pod through the Kubernetes auth method, and have it fetch dynamic database credentials that expire after an hour.
Key concepts
- Seal, unseal and auto-unseal
- Auth methods
- Policies and tokens
- KV v2 secrets engine
- Dynamic database credentials
- PKI and Transit engines
- Vault Agent and injector
- Raft storage and HA
- OpenBao fork
Mini project
Deploy Vault to a local Kubernetes cluster, configure Kubernetes auth and the database secrets engine for Postgres, and inject short-lived credentials into an app pod with the Vault Agent injector.
Check yourself
Why are dynamic database credentials safer than a single shared password stored in Vault's KV engine?
Free resources
- Vault documentation (HashiCorp)
- Vault tutorials (HashiCorp)
- OpenBao documentation (OpenBao)