Auto-auth
Agent obtains and renews a token through a configured auth method.
Chapter 10 of 16 · Application/workload user · orders-api
Use Vault Agent auto-auth and templates to separate token lifecycle from application code while preserving a clear reload contract.
Chapter 7 complete, AppRole inputs present, and the Compose Agent profile available.
orders-api receives an Agent-rendered file and proves freshness, permissions, and reload signaling.
| Owner | Consumer-facing responsibility |
|---|---|
| You own | Defines consumption, validation, reload, and stop-using behavior. |
| Platform team owns | Provides trusted runtime identity, protected delivery, network, and telemetry. |
| Vault owns | Operates auth mounts, policies, engines, audit, and recovery. |
Agent obtains and renews a token through a configured auth method.
A controlled rendering of selected Vault data.
Protected token output; omit it unless another process needs it.
A bounded hook run only after successful render.
cd learn-vault/labs/bootstrap
docker compose --profile agent up -d vault-agent
cd ../vault-agent
./wait-for-render.sh
./inspect-render.sh| Symptom | The app keeps old configuration while Agent is running. |
|---|---|
| Likely causes | Template error, policy denial, renewal failure, rename mismatch, or reload hook failure. |
| Inspect safely | Check Agent state, render mtime, error class, reload marker, and KV version. |
| Do not print | Rendered content, token sink, SecretID, or Agent environment. |
Break it: Stop Agent after the first render and let the file become stale.
Fix it: Restore auto-auth, require a successful new render, then verify the application reload marker.
Escalate with time, endpoint, auth path, role, mount, namespace when relevant, status code, request ID, and sanitized error class. Never attach a credential or response body.
labs/bootstrap owns the disposable server, auth mounts, policies, roles, and engines; learner actions begin after setup.
$0; local containers only
Run labs/bootstrap/setup.sh and source .runtime/learner.env unless the chapter lab says AppRole alone is sufficient.
Start the Agent profile, wait for a protected render and reload marker, then inspect mode, mtime, and schema keys only.
cd learn-vault/labs/bootstrap
docker compose --profile agent up -d vault-agent
cd ../vault-agent
./wait-for-render.sh
./inspect-render.sh
test -f ../../.runtime/reload.request
./cleanup.sh
Complete every item in the Verify section using metadata-only evidence; no secret value appears in terminal output or tracked files.
Use the Failure drill and Break it / fix it evidence fields. Stop before broadening policy, weakening identity or TLS checks, or copying secret-bearing diagnostics.
Stop the Agent profile and remove renders and markers; keep core services if continuing.
orders-api receives KV configuration through an Agent file-and-reload contract and exposes render age only.
Token acquisition, renewal, and template retrieval mechanics.
The application contract.
No. Omit it when no separate process needs the token.
Agent state, freshness, schema validity, and app acceptance.
Agent is a lifecycle sidecar, not an ownership shortcut: the app still defines valid, fresh, and reloadable.