Skip to main content
An env var can point at a secret in an external Vault instead of holding a value in Levelrail. Levelrail stores only the reference (a path and a field). The value is read just before the container is created and is not saved.

Which backends are supported

The Vault Transit engine (Vault or OpenBao) can also wrap the master key. That is a separate feature, set with the APP_VAULT_* variables in Environment variables. It does not enable app references.

Connect Vault once

The connection is per control plane, not per app.
Other flags on vault set: The address is required the first time. The credential is stored encrypted, is write-only, and is never shown by vault get. The same settings are under Settings, Vault and at PUT /api/v1/settings/vault. Rotate the stored credential without downtime. The old one keeps working for the grace window (APP_SECRET_ROTATION_GRACE_HOURS, 24 hours by default):

Reference syntax

In app.yaml:
path is the secret path inside the KV v2 mount. Do not include the mount name or data/. key is the field in that secret. The field must be a string. A variable can use only one of from, secret and vault. On the command line, when you create an app from an image or a git build:
The format is KEY=path#field. It splits at the last #, so a path may contain #. The flag is repeatable. For an existing app:
The API is PUT and DELETE /api/v1/apps/{name}/vault-env/{key}.

When values are read

Levelrail does no caching. Every time the reconciler creates a container for the app, it logs in to Vault and reads the secret again. A change in Vault shows up in the app the next time its container is created, not before. To pick up a new value, redeploy the app. Because each read is a fresh login, Vault must be reachable from the control plane at every deploy.

Troubleshooting

An unresolved reference fails the deploy. The container is never started with the variable empty or missing. The error names the variable, the path and the field. Check the connection before you deploy:
The second command uses the Vault CLI with the same token, to confirm the path and field exist.
Last modified on November 5, 2026