Skip to main content
Platform

Where database credentials live

:::note Verified against the live cluster (2026-11-21) The companion to the DBeaver DB cockpit: that page is how you connect; this one is where the password comes from. The discipline behind it is the auto-loaded rule db-credentials.md. :::

Credentials live in three places, by role β€” never conflate them.

1. Runtime copy β€” a Kubernetes Secret in each DB's namespace (always)​

What the pods, and the DBeaver kubectl … get secret … | base64 -d one-liner, actually read.

  • CNPG clusters β†’ <cluster>-app (kubernetes.io/basic-auth: username/password/dbname), owned by the CNPG Cluster. e.g. ktayl-core-cnpg-app.
  • Plain / vendor DBs β†’ a named Opaque Secret: ai-postgresql-secret, backstage-postgres-secret, temporal-db-secret, bookstack-db-secret, ktayl-itsm-db, erpnext, …

2. Source of truth β€” where the password comes from​

SourceDatabasesRotate by
Vault secret/platform/* β†’ ESO (authoritative β€” the standard)all plain/vendor DBs (ai, backstage, temporal, bookstack, itsm, erp, ktayl-iam-dev, langfuse-clickhouse) + the CNPG clusters with a *-role ExternalSecret: authentik Β· synapse (chat) Β· data-platform Β· ktayl-iam (prod) Β· langfuse Β· nextcloud Β· retrieva Β· ktayl-core (prod) Β· claims (prod) Β· underwriting (prod) Β· paperless (last 4 backfilled 2026-11-21)edit Vault β†’ ESO re-renders the k8s Secret β†’ CNPG reconciles
CNPG operator-generated (the -app secret is the only store)(none β€” every CNPG cluster is now Vault-sourced, dev + prod, as of 2026-11-21)β€”

How the Vault-sourced CNPG case works: the cluster's spec.managed.roles[].passwordSecret points at an ESO-rendered secret (e.g. retrieva-cnpg-role), so the role password traces to Vault; the operator keeps <cluster>-app reconciled to it. Reference clusters: retrieva-cnpg, langfuse-postgres.

3. Human break-glass β€” Vaultwarden (emergency, SSO down)​

Emergency admin logins live in the Vaultwarden controller-break-glass folder; Vault's own crown-jewels are age-encrypted on the controller. These are not the per-DB runtime creds (most DB app passwords are in Vault/CNPG, not individually in Vaultwarden). Vault auto-unseals via AWS KMS, so a reboot needs no human key.

The discipline (the standard for every NEW database)​

Vault is the source of truth for every database credential; the in-namespace k8s Secret is a rendered copy; human break-glass is Vaultwarden; nothing else.

  • CNPG β†’ source the role password from Vault via an ESO ExternalSecret referenced by managed.roles[].passwordSecret. Do not ship a cluster whose only store is the operator -app secret.
  • Plain/vendor DB β†’ credential via ESO from Vault; never a chart default, never a literal in values, never committed (the guard-write hook blocks secret material).
  • Gap fully closed (2026-11-21): all formerly operator-generated clusters β€” prod and dev (ktayl-core, claims, underwriting, paperless) β€” were backfilled. Vault seeded with the current -app password, then managed.roles + a -role ExternalSecret wired (no-outage: CNPG re-applied the identical value). Every CNPG cluster on the platform now sources its credential from Vault.

Full rule (authoritative): db-credentials.md.

Retrieve any DB password (works in every case β€” reads the runtime Secret)​

# CNPG:
kubectl --context minicloud-oidc -n <ns> get secret <cluster>-app \
-o jsonpath='{.data.password}' | base64 -d; echo
# plain/vendor β€” discover the key first:
kubectl --context minicloud-oidc -n <ns> get secret <name> \
-o go-template='{{range $k,$v := .data}}{{$k}}{{"\n"}}{{end}}'

The *-cnpg-r2 secrets alongside a CNPG cluster are R2 backup credentials, not a DB login.

One server, many databases β€” database isolation β‰  operational isolation​

A single Postgres server (one instance / one host:port, one login) can hold many databases. Most apps use one (retrieva server β†’ retrieva DB), but two are deliberately multi-database:

  • ai platform pg (postgresql-ai) β€” one shared server with a database per AI tool: openwebui, litellm, ragdb, vaultwarden, flowise, mlflow (6).
  • backstage β€” database-per-plugin mode: backstage_plugin_catalog, _auth, _scaffolder, … (13).

Think of the server as an apartment building and each database as an apartment: the postgres superuser is the master key, but you still pick which database to open (in DBeaver, set the connection's Database field β€” the default empty postgres DB shows no tables).

Hosting many app databases on one server is a deliberate placement choice with a sharp distinction:

Database isolation (DB + role per app)Operational isolation (a dedicated cluster)
controls access β€” what each app can read/writecontrols blast radius β€” CPU/mem/storage-I/O, a cluster-wide outage/upgrade, and the backup/PITR recovery boundary

The boundary people miss: a CNPG physical backup restores the whole cluster, not one database. Recovering only litellm to yesterday means restoring the cluster to a temporary instance and extracting the litellm DB. So: consolidate low-risk apps as DB + role per app on a shared CNPG cluster (with per-role connection limits); keep Authentik and Vaultwarden on dedicated clusters (their outage/recovery must be independent). The authoritative decision rule + per-workload table: datastore-selection.md.