bothBoth ways authenticate with the pod's ServiceAccount token (Kubernetes auth); OpenBao verifies it via TokenReview.
The injector adds an openbao-agent sidecar. It logs in, renders the secret into a file
and refreshes it every 30 s. The app just reads a file — no OpenBao client, no tokens.
vault.hashicorp.com/agent-inject: "true"
vault.hashicorp.com/role: "demo-app"
vault.hashicorp.com/agent-inject-secret-config: "kv/data/demo/config"
vault.hashicorp.com/agent-inject-template-config: |
{{- with secret "kv/data/…" -}}{{ .Data.data | toJSON }}{{- end -}}
| Key | Value from file |
|---|---|
| api_key | sk-demo-1234567890 |
| message | Hello from OpenBao |
The app logs in itself with its ServiceAccount JWT, caches the client token and calls the KV v2 API — immediate reads plus writes, versions and check-and-set.
POST http://openbao.openbao.svc:8200/v1/auth/kubernetes/login
{"role": "demo-app", "jwt": "<ServiceAccount token>"}
GET /v1/kv/data/demo/config X-Vault-Token: …
POST /v1/kv/data/demo/config {"options": {"cas": N}, "data": {…}}
| Key | Value from API |
|---|---|
| api_key | sk-demo-1234567890 |
| message | Hello from OpenBao |
After a write the API answers immediately; the file follows with the next sidecar render.
| Key | ① File | ② API | |
|---|---|---|---|
| api_key | sk-demo-1234567890 | sk-demo-1234567890 | synced |
| message | Hello from OpenBao | Hello from OpenBao | synced |
Saving creates a new version with check-and-set (cas=3) —
concurrent edits are rejected instead of overwritten. Then watch ① catch up.
Restore writes an old version as a new one.