Architecture Overview
When you install Vault with the official Helm chart, two key pods are deployed:| Pod Name | Role |
|---|---|
| vault-0 | Primary Vault server. Initialize Vault, add secrets, configure policies and auth. |
| vault-agent-injector | Mutating webhook controller that injects Vault Agent containers into application Pods |
- Authentication & Authorization
- Mutating Admission Controllers (includes Vault injector)
- Schema & Validation Admission Controllers
- Persistence to etcd
Injecting the Vault Agent into a Pod
To enable automatic injection, annotate your Pod manifest:vault-agent-injector webhook intercepts Pod creation, it adds:
- Init Container
Fetches secrets from Vault and writes them to a shared volume. - Sidecar Container (Vault Agent)
Continuously renews the Vault token and re-renders secrets into the same volume.
Make sure your Kubernetes service account has the proper
system:auth-delegator role binding so Vault can perform TokenReview requests.Authentication Flow
Injected containers authenticate to Vault using the Pod’s service account JWT:- Vault Agent sends a POST to Vault’s Kubernetes auth endpoint with the JWT.
- Vault calls the Kubernetes TokenReview API to validate the token.
- If the response is authenticated and matches a bound role, Vault issues a client token.
- The token is stored at
/home/vault/.vault-tokeninside the agent container.
Sample TokenReview Request
Configuring Vault Roles and Policies
On your Vault server (vault-0), enable Kubernetes auth and bind service accounts to policies:
Ensure your policy paths match the KV engine mount and data structure in Vault. Incorrect paths will result in denied access.
Fetching and Rendering Secrets
- Init Container retrieves secrets:
- Writes them into a shared volume (e.g., mounted at
/vault). - Application Container reads secrets as files: