OpenBao Demo

Two ways to consume a secret on T-Cloud CCE · mode both
① and ② in sync

Architecture

Both ways authenticate with the pod's ServiceAccount token (Kubernetes auth); OpenBao verifies it via TokenReview.

Pod demo-app · ServiceAccount demo-app openbao-agent sidecar · renews token /vault/secrets/config shared emptyDir · JSON read file 1 login + read · re-render every 30 s App (Flask) this page 2 login + KV v2 read / write OpenBao auth/kubernetes · role demo-app kv/demo/config Kubernetes API TokenReview validates the SA JWT

1Agent sidecar → file

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.

File
/vault/secrets/config
File changed
160 s ago
Read time
0.1 ms (local file)
  • + zero code dependency, works for any language or config file
  • + last rendered file survives a short OpenBao outage
  • − read-only, changes arrive with up to 30 s delay
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 -}}
KeyValue from file
api_keysk-demo-1234567890
messageHello from OpenBao

2Direct API (Kubernetes auth)

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.

Endpoint
http://openbao.openbao.svc:8200
Version
v3
Token
cached, 3465 s of 3600 s left
Read time
4.1 ms (network + OpenBao)
  • + always current, can write, list versions and restore
  • − needs OpenBao client code and token handling in the app
  • − every read depends on OpenBao being reachable
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": {…}}
KeyValue from API
api_keysk-demo-1234567890
messageHello from OpenBao

Compare ① file vs ② API

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

Edit secret via ②

Saving creates a new version with check-and-set (cas=3) — concurrent edits are rejected instead of overwritten. Then watch ① catch up.

KeyValueDelete
api_key
message

Version history via ②

Restore writes an old version as a new one.

  • v3 current
    2026-11-23 11:25:11 UTC
  • v2
    2026-11-23 11:25:10 UTC
  • v1
    2026-11-23 11:14:27 UTC