Skip to content
Prompt Words
History Member

Secrets manager

Also called: secret store.

A service that stores passwords, API keys and other secrets, and hands each one at run time only to the apps allowed to have it. It can change stored passwords on a schedule (rotation) or make short-lived ones on demand (dynamic secrets), so nothing secret sits in the code, the config or the image. The app still has to prove who it is to the manager, usually with an identity its platform gives it, such as a Kubernetes service account, so whoever controls the running pod can read its credentials; short leases limit the damage.

Start the app, then rotate the password (time is shortened): each lease is a new database user (dynamic secrets), with no redeploy. A stored password can instead be changed on a schedule. Then bake it into the image, the old way. The pod logs in with its Kubernetes identity, so it needs no password.

Clock: 09:00 · Leases: 0 · Revoked: 0 · Rebuilds: 0

The app needs a database password. It isn't in the code or the image: it has to ask for it.

    No app yet

    Say it in a prompt

    Give the shop API its Postgres login from HashiCorp Vault, not from the image or an env file. The pod logs in to Vault with its Kubernetes service account shop-api (the kubernetes auth method) and reads database/creds/shop, which creates a Postgres user with a 1-hour lease (default_ttl=1h, max_ttl=24h). Get new credentials before the lease ends, reconnect with them, and let Vault revoke the old user. Never log the password.

    Vague vs precise prompt

    Vague prompt

    connect the app to the production database

    Typical resultPuts the database password in the code, in a .env file copied into the Docker image, or in a build argument or ENV line. Deleting the file in a later layer still leaves it in the earlier one, and the image history shows build arguments and ENV. Anyone who can read the repo or pull the image has the password, and changing it means a rebuild and a redeploy of every service that uses it.

    Precise prompt

    Get the Postgres login from Vault at start-up: log in with the pod's Kubernetes service account, read database/creds/shop with a 1-hour lease, get new credentials before it ends, and never log the password.

    Typical resultNo password in the code, the image or an env file. Each pod gets its own short-lived database user; a new one takes over before the lease ends and the old one is revoked, with no rebuild or redeploy.

    Seen on

    • HashiCorp Vault docs: The database secrets engine creates database credentials on demand, a different user for each client, and revokes the user when its lease ends, so services no longer hard-code a password. The docs' example role sets a 1-hour lease (default_ttl=1h).
    • HashiCorp Vault docs: With the Kubernetes auth method a pod logs in with its service account token, and Vault checks that token with the Kubernetes TokenReview API, so the pod needs no stored password to get its secrets.
    • AWS Secrets Manager docs: Replace hard-coded credentials with a call to Secrets Manager at run time. Because the credentials no longer live with the application, rotating them needs no update or redeploy of the application.
    • Kubernetes docs: A Secret keeps a password or token out of the Pod spec and the container image, but by default it is stored unencrypted in etcd. The docs advise encryption at rest, tight access rules and, where needed, an external secret store.

    You might describe it as

    • keep the database password out of the code and the image
    • change the password without a redeploy
    • the app fetches its credentials when it starts

    Not to be confused with

    • Sidecar

      A sidecar is a helper container in the same pod; a secrets manager is the service that stores and hands out secrets, and a sidecar is one common way to deliver them to the app.