Secret from Vault: ancient Greek city

Sparta

Secret at startupSparta
Secret on disk nowSparta
App started at2026-12-01 05:04:39 UTC
Secret file path/etc/secrets/city

Same secret, two ways

Loaded asValueUpdates on rotation?
File (volume mount)SpartaYes, within ~15 min (configurable)
Env var CITY (secretKeyRef) SpartaNo, only after a pod restart

Update the secret in Vault and the file value changes without a restart.

Why?

File: the kubelet watches the Kubernetes Secret and rewrites the mounted files when it changes. The app reads the file on every request, so it sees the new value.

Env var: environment variables are copied into the process once, when the container starts. Kubernetes cannot change them in a running process, so the old value stays until the pod is restarted.