Skip to main content

Rotate a credential

The one thing to know before you start: every credential reaches its container as an environment variable, read once at container start. Kubernetes does not restart a pod when a Secret it references changes. Jobs and CronJobs get the current value on their next firing, because that is a new pod.

What restarts the Deployments depends on who owns the Secret:

  1. The chart's own Secret (secrets.* in your values). Each Deployment carries a checksum/secret annotation. A helm upgrade that changes a value in that Secret restarts each Deployment that reads that value. The other Deployments keep running. The bundled Postgres is not restarted. encryption-key and the Postgres password need more than that. See "Rotating encryption-key" and "The Postgres password changes in the database first" below.
  2. Your own Secret (existingSecret). Helm cannot see your Secret, so nothing restarts. A rotated value reaches a running pod never until you restart it. This is the failure where the rotation appears to work for hours and then does not survive the next unrelated restart. Treat the restart in step 2 as part of the rotation, not as cleanup.
CredentialSecret keyRead byRestart
Inference keytare-inference-keyagent runnerthe runner
Admin platform keytare-platform-api-keyagent runnerthe runner
Router management keyvalet-api-keymanagement MCP, spend sweepthe management MCP (the sweep is a Job)
GitHub tokengithub-tokenGitHub Live MCP, ingestthe GitHub Live MCP, if enabled
GitHub Live tokengithub-live-tokenGitHub Live MCP, when secrets.githubLiveToken or mcps.githubLive.ownToken is setthe GitHub Live MCP
Jira tokenjira-tokeningest onlynothing — the next Job picks it up
SMTP passwordsmtp-passwordthe appthe app
App JWT secretapp-jwt-secretthe app and the runnerboth, together
Postgres passwordpostgres-passwordapp, MCPs, ingest, and the bundled Postgres at its first start onlyeverything that connects, after you change it in the database: see below
Runner database URLrunner-database-urlagent runnerthe runner
At-rest keyencryption-keyagent runner, the app, the semantic and discovery MCPs, the ingest tick, and the GitHub and Jira ingest and check jobsthe runner, the app and both MCPs (the tick and the ingest and check jobs need nothing) — and see the warning below
Internal query secretmcp-shared-secretthe app and all six query serversall seven, and see the note below
Viewer signing secretmcp-viewer-secretthe runner and all six query servers, only with viewerScoping.enabledall seven, and see the note below
Sign-in proxy keyproxy-keythe app, only under easyauth or iap; your sign-in proxy holds its own copythe app and the proxy, in the order below

Not every credential is in that table. The table lists credentials held as Kubernetes Secret keys. A credential you add through the admin surface — a database connection to a warehouse, for example — is held in the appliance's own database instead, and it is rotated there rather than with kubectl: replace the value on the connection and the next read uses it, with no Secret to patch and no pod to restart. What proves such a value is the probe the admin surface runs as you enter it — not the self test in step 3, which says below exactly what it does and does not cover. Those credentials are protected by the encryption-key Secret, so rotating that key is a separate and much larger operation than rotating any one credential.

A query-through warehouse is rotated on the source, and only there. Its key pair used to be in both places at once — a Secret the semantic MCP signed in with, and a copy on the source row the probe used — with nothing checking that the two agreed, so replacing one and not the other left a source that either probed green and answered nothing or answered and failed its probe. That is gone. There is one copy, on the source: replace it in the admin surface, probe again, and the next question uses it. No Secret to patch, no pod to restart.

Rotating encryption-key is a re-entry, not a restart​

encryption-key is the only row in that table that does not protect one thing. It is the key everything else is stored under:

  • every per-user Agent Router key the runner has custody of,
  • every data-source credential entered through the admin surface, and
  • the internal query secret on the runner's query-server profiles, which the app writes again after it restarts (step 2), except on a profile its configuration no longer names.

None of them is re-encrypted when the Secret changes, and there is no second key: a new value does not re-key what the old one wrote, it makes it unreadable. So rotating this key is a planned operation with a re-entry step, not a rolling restart:

  1. Note which sources hold a credential: GET /api/admin/sources (as a super admin) reports has_credential and credential_updated_at per source; the value itself is never shown, here or anywhere else. Admin → Context streams carries the same two facts on each source's Overview tab, so the list can be taken off the page rather than the API.

  2. Change the Secret value and restart all four long-running consumers — the agent runner, the app, the semantic query server and the discovery query server (mcp-discovery). The ingest tick and the GitHub and Jira ingest and check jobs need nothing: they are CronJobs and Jobs and pick the new value up on their next firing. A run already in progress keeps the old key until it ends.

    The semantic query server was missing from this list until 2026-09-04, and it is the one that matters most here: it is the container that opens a query-through source's stored credential, so a rotation that left it holding the old key would leave every warehouse source unreadable with the app and the runner both looking healthy. The discovery query server opens the same stored credentials, so it is restarted for the same reason.

    With the chart's own Secret, the helm upgrade that changes the value restarts all four at once. So detach the profiles (below) before that upgrade. Then restart the app once more when the runner is ready, for the reason in the next paragraph.

    Restart the runner BEFORE the app, and this is new in 0.11.0. The app writes the internal query secret onto each of the runner's query-server profiles, and the runner stores it encrypted with this key. It does that write once per app process, on the first conversation after the app starts. So an app restarted first writes the secret under the OLD key, records that it has done so, and when the runner then restarts it cannot read what was just written, and every question fails. Restarting the app a second time repairs it. Doing the runner first avoids it entirely.

    A query-server profile your configuration no longer names keeps the old value. The app writes the secret again only on the profiles its configuration names, and attaches those to the shared agent. Any other profile still attached, such as one for a server since switched off, is left alone, and once the runner restarts every question fails on it. So before you restart anything, detach every profile from the shared agent in the runner database (connected as in step 4). On the next conversation the app attaches the ones it is configured with again, under the new value, and leaves the rest detached:

    kubectl exec -n <namespace> statefulset/<release>-postgres -- \
    psql -U postgres -d runner -c "
    DELETE FROM agent_mcp_profiles
    WHERE agent_id = (SELECT id FROM agents
    WHERE customer_id = '<app.customerId>'
    AND project_id = '<app.projectId>'
    AND slug = '<app.agentSlug>');"
  3. Re-enter every source credential. On Admin → Context streams this is the source's Credential tab and its Save and test button; through the API it is POST /api/admin/sources/<id>/credential with the credential's fields (for example {"secret": "<token>"}) — the path segment is the row's id, the UUID GET /api/admin/sources reports, and a name there is a 404. Each entry is probed before it is stored, so a source that comes back green has been re-keyed and re-checked in one step. A source that is switched on will not accept a credential the probe did not pass — that is what keeps a connected source connected to something that answered — so if the probe cannot run at all, switch the source off, enter the credential, and switch it on again once it probes.

  4. Revoke every per-user Router key the runner holds, after step 2. The runner does not mint a new key when it cannot open the one it holds: it fails. Until their keys are revoked, everyone who already had one fails on every question, and their old key stays live on your Agent Router. Revoking needs nothing from the old value: the runner revokes a key by its Router id, which it does not encrypt, and then removes its copy. That person's next question mints a new key under the new value. Revoking before step 2 is too early, because a question asked in between would mint a key under the old value.

    List who holds one in this install's project, from the runner database. Here that is the bundled Postgres. On an external database, run the query with psql from somewhere that reaches it, using runner-database-url without its uselibpqcompat=true parameter, which psql refuses:

    kubectl exec -n <namespace> statefulset/<release>-postgres -- \
    psql -U postgres -d runner -c "
    SELECT k.subject_user_id, k.key_ref, u.email,
    coalesce(u.subject, k.subject_user_id) AS sign_in_id
    FROM user_router_keys k LEFT JOIN users u ON u.id = k.subject_user_id
    WHERE k.project_id = '<app.projectId>';"

    For each person, use revoke Router keys on their App users row, or the Revoke Router keys box with their sign-in id (as for someone who leaves). The page warns that their next question mints a new key; here, that is the point. The list can include the self test's own identity, which has no App users row: use the box for it.

    When app.projectId is not default, the page reports each revoke as requested rather than confirmed, as it does for someone who leaves. If it reports that the Router has no API key with that id, the runner keeps the row, and that person's questions keep failing until the row is removed by hand. The runner's own message says such a key may still be live. Once the row is gone, its key_ref from the list is the only way to find the key, so keep it and ask your Agent Router administrator to revoke the key by that id. Then remove the row:

    kubectl exec -n <namespace> statefulset/<release>-postgres -- \
    psql -U postgres -d runner -c "
    DELETE FROM user_router_keys
    WHERE subject_user_id = '<subject_user_id from the list>'
    AND project_id = '<app.projectId>';"

    An install whose runner holds a deployment inference key (secrets.inferenceKey, or tare-inference-key in your own Secret) mints no per-user keys and has nothing to do in this step.

Until step 3 is done, the scheduled ingest of any source whose credential was stored in the registry fails and says so — it refuses to fall back to an older environment credential, because authenticating as a possibly-different identity is worse than not running. An install that has never used the admin surface to enter a credential has nothing in step 3 to redo.

Step 1 — change the value. For the Postgres password, change it in the database first, as "The Postgres password changes in the database first" below says. Which command depends on who owns the Secret:

# chart-managed Secret (secrets.* in your values)
helm upgrade <release> <chart> -n <namespace> -f <your values file> \
--set secrets.githubToken=<new token>

# existingSecret — the chart renders no Secret, so patch yours directly
kubectl patch secret <your secret> -n <namespace> \
-p '{"stringData":{"github-token":"<new token>"}}'

Step 2 — restart what reads it, per the table. With the chart's own Secret, the helm upgrade in step 1 has already restarted each Deployment that reads the value. So this step is needed only under existingSecret and for encryption-key:

kubectl rollout restart deploy/<release>-agent-runner -n <namespace>
kubectl rollout status deploy/<release>-agent-runner -n <namespace>

app-jwt-secret is the one with an ordering trap. The app signs the tokens the runner verifies, so while the two hold different secrets every call between them fails. Change the value once, then restart both and expect chat to fail in between — this is a short outage, not a rolling change, and doing it during a demo is a bad idea.

mcp-shared-secret has the same shape of trap and one extra step, which the appliance takes for you. Five workloads hold it — the app and the four internal query servers — and while any of them disagrees, the questions that route through the disagreeing server come back unanswered rather than wrong. Change the value once, then restart all five:

kubectl rollout restart deploy/<release>-app deploy/<release>-mcp-management \
deploy/<release>-mcp-semantic -n <namespace>
# and, where they are enabled:
kubectl rollout restart deploy/<release>-mcp-discovery \
deploy/<release>-mcp-github-live -n <namespace>

The extra step is the agent's own copy. The agent reaches these servers through the runner, which holds the secret on each of its query-server profiles rather than reading it from its own environment — so the runner is deliberately absent from the list above. The app pushes the new value onto those profiles on its first provisioning pass after it restarts, which is the first new conversation anyone opens. Nothing is owed from you; it is worth knowing because it explains why an in-flight conversation can still fail for a moment after every pod above is green, and why restarting the runner does not help.

There is no value of this secret that turns the check off. Blank is not "unauthenticated" — it is "refuse everything" — so a rotation that lands an empty value is an outage, not a security regression, which is the way round we wanted it.

mcp-viewer-secret exists only with scoped viewers on (viewerScoping.enabled). The runner signs a short-lived token with it on every tool call, saying who is asking, and each of the four query servers checks that token. The app never holds it. It has the same trap as mcp-shared-secret: while the runner and a query server disagree, every tool call to that server is refused with "Who is asking could not be verified", and nothing is answered wrongly. Change the value once, then restart the runner and all four query servers together:

kubectl rollout restart deploy/<release>-agent-runner deploy/<release>-mcp-management \
deploy/<release>-mcp-semantic -n <namespace>
# and, where they are enabled:
kubectl rollout restart deploy/<release>-mcp-discovery \
deploy/<release>-mcp-github-live -n <namespace>

The value must be at least 32 bytes, and different from both app-jwt-secret and mcp-shared-secret. Set through secrets.mcpViewerSecret, the chart checks both of those when it renders. With existingSecret, the chart can't see the value, so it doesn't check it. A missing mcp-viewer-secret key stops the pods at start, naming the key, and a value shorter than 32 bytes stops each query server at start with a message saying so. Either way the failure is a pod that won't start, never a server that runs with a weak key. Generate one with openssl rand -hex 32.

proxy-key rolls without an outage, because the app holds two. The app reads it, and your sign-in proxy sends it. While they disagree, every request is refused with "This request did not come through the configured sign-in proxy". So give the app both keys first, separated by a comma:

  1. Set the value to <old>,<new> and restart the app. Both keys work now. With --set, escape the comma (--set 'secrets.proxyKey=<old>\,<new>'), or Helm reads it as a list.
  2. Change the proxy's own copy to <new>, and restart it.
  3. Set the value to <new> alone, and restart the app.

The order of the two keys does not matter. A key must be at least 32 printable characters with no space or comma (openssl rand -hex 32); the chart refuses anything else when it renders, and so does the app when it starts.

The Postgres password changes in the database first. The bundled Postgres reads postgres-password only on its first start, when it creates its data. After that, a new value in the Secret does not change the password the database checks. If you change only the value, the database refuses the new password. So rotate it in this order:

  1. Change the password in the database. For the bundled Postgres, run this. It asks for the new password twice.

    kubectl exec -it -n <namespace> statefulset/<release>-postgres -c postgres -- \
    psql -U postgres -c '\password postgres'

    On an external database, change the password of the postgres.external.user role with your database's own tools.

  2. Straight away, change the value, as step 1 above says. With the chart's own Secret, that helm upgrade restarts every Deployment that connects. With existingSecret, change two keys in your Secret: postgres-password, and the password inside runner-database-url, percent-encoded. The runner reads only the URL. Then restart every Deployment that connects, as the table says.

If you already changed only the value and the upgrade failed, do step 1 now, with the new password. Then run the same helm upgrade again, so Helm records the release as deployed.

With the chart's own Secret, helm rollback cannot cross a password change. The rollback puts back the earlier revision's Secret and its migrate Job, both with the old password, and the database refuses that password. To go back to an earlier version after a rotation, run helm upgrade with that version's chart and your current values instead. If a rollback was already refused, follow Rolling back first.

Between these two steps, connections that are already open keep working. A new connection with the old password is refused. Expect a short outage for anything that opens a new connection in that time.

Step 3 — prove it. Run the self test. What it exercises, credential by credential:

CredentialThe line that would go red
Inference keythe agent runner line and the AGENT ROUTER group
App JWT secretagent runner — runner rejected the app tokens
Internal query secreteach mcp * line — refused this app's shared secret (401)
Router management keymcp agent router usage
Postgres passworddatapond postgres
SMTP passwordsmtp relay, per super-admin address
GitHub token, Jira tokentheir SOURCES lines — with the two caveats below
Router spendthe spend SOURCES line, only under sources.spend=indexed

The mcp * row is the one worth knowing about: a rotation of mcp-shared-secret that reached some of the seven workloads and not the others is exactly what those lines are written to name, and it is the failure this page's own warning above is about.

Under sources.spend=live there is no spend verdict to read. The line reports live · served by the Agent Router usage API (no local index) and the chart renders no check job for it at all; whether the Router answers is the AGENT ROUTER group's verdict, not this one's.

The SOURCES group is not a list of your streams. Its per-source lines are a fixed set written into the app — the GitHub mirror, the GitHub issue index, Jira and spend — not a reading of what you have connected. A stream you added on Admin → Context streams gets no line that tests its credential. With the stream registry on you will see source registry, designated route, recipe drift, identity crosswalk and identity attribution in the same group, and three of those print your designated stream by name — so the group does not look silent about it. Read what those lines actually say: they report the registry rollup and the last compiled crosswalk. None of them opens a connection to the stream, so none of them is evidence about a credential you have just replaced.

Two caveats on the GitHub and Jira lines, and both are about a verdict that is not current:

  • It can be up to half an hour old. The app holds no GitHub or Jira credential of its own, so those lines show the verdict last recorded by the prism-ingest check CronJob — ingest.checkSchedule, every 30 minutes by default. A rotation done as a helm upgrade re-records it before the command returns, because that check also runs as a post-upgrade hook. A rotation done with kubectl patch secret does not, so a green line can still be describing the credential you have just replaced. Wait for the next firing.
  • If you moved that stream's credential onto its row in the admin surface, every job uses the stored one. The check, the ingest tick and the GitHub profile sweep all read the row first, and the line then reports the credential you entered rather than the Secret's. Removing the Secret's value is then safe for those jobs; the opt-in live GitHub tools still read the Secret. Rotate it on the row, and prove it the way the next paragraph describes.

A credential you entered in the admin surface is proved when you enter it. The credential route probes the value before it stores it: a probe that fails writes nothing and leaves the old credential exactly where it was, so a rotation that would have broken the stream is refused at the moment you make it rather than discovered later. A stream that is already enabled will not take a credential this request has not probed at all — it refuses the store instead, so the enabled state never outlives the evidence behind it. The verdict is on the stream's row on Admin → Context streams. Two stores go through unproven, and both leave the stream switched off until something proves it: asking for the store without a probe, which only a disabled stream will accept, and a stream of a kind this build cannot probe — that one says so rather than passing, and keeps the value for custody.

An uploaded staff list has no credential to rotate at all. Nothing is fetched from it: it is fed, and what stands where a probe stands is the upload itself.

For a query-through warehouse the probe is the whole story, and it is the change worth knowing about if you rotated one before 0.11.0: the key pair used to sit in two places at once, and the probe now authenticates with the one copy there is, so a passing probe is evidence about the key you have just entered. It also checks the session it was given against the session it asked for, so a warehouse that no longer exists is a refusal rather than a pass. Asking a question the stream answers is still the last step, and still the only one that exercises the whole path.

The GitHub token may be the one with a clock on it. A fine-grained personal access token's lifetime is chosen when it is minted — GitHub allows a non-expiring one, but an organisation or enterprise policy can forbid that and can cap the maximum well under a year, so ask which you were given. Where it does expire, record the date and name who owns the rotation at go-live rather than at the first red line: the scheduled probe does report an expired credential, but it reports it on the day it stops working, and a token nobody owns is a token nobody renews.

Mint the replacement from the same list the first one came from — What the GitHub credential needs — and check each line rather than assuming: the same resource owner, All repositories rather than a subset, the same three repository permissions, and approved by an organisation owner where that organisation requires approval. A replacement narrower than what it replaces is the failure below, and the repository-subset version of it does not fail at all.

A replacement wider than what it replaces does not fail either, and it leaves a step in your data. Rotating a token onto a broader grant — the common case being a fine-grained token re-scoped from a hand-picked list to All repositories — is invisible to Prism: nothing errors, the self test stays green, and the newly reachable repositories start appearing in the sweeps that happen after the rotation. The days already walked keep the narrower scope for ever. No ordinary run revisits them, and neither of the two verdicts that normally mark an incomplete day can fire — capped_days describes a day that hit the per-query ceiling, unenriched_days a day whose enrichment could not be reached, and both are about rows the walk knew it missed. These are rows it never knew existed.

So a question spanning the rotation date answers low and confident, with no caveat. The repair is the same one-off re-sweep a widened grant needs — ingest.github.rewalkFrom, and ingest.jira.rewalkFrom for Jira — and the procedure, including how far back to set it and how to prove it landed, is Widen a source's scope. If the credential you are rotating to can see more than the one it replaces, do that page as well as this one.

A GitHub App has a key rather than a token, and the key does not expire. Where the credential is an App (when the credential cannot see the whole organisation), secrets.githubAppPrivateKey is the thing to rotate and there is no expiry date to diarise — which cuts both ways. Nothing will ever tell you it is old, and it is a stronger credential than any token it replaces: an installation token is scoped to one installation and lives an hour, while the private key mints tokens for every installation of that App, for as long as it exists. Treat it like the App's password, put a date in your own calendar, and prefer installing the App on the organisations you are measuring and no others — the key's reach is the App's reach, not this appliance's.

Rotating it is one helm upgrade and needs no coordination: generate a new private key on the App's settings page, upgrade with --set-file secrets.githubAppPrivateKey=./the-new.pem, confirm the pre-flight still reports "credential": "github_app" with the repository count you expect, then delete the old key at GitHub. Do it in that order: GitHub lets an App hold more than one key at a time precisely so the overlap can be arranged, and deleting first turns a rotation into an outage. Tokens already minted from the old key keep working until they expire, which is at most an hour.

If the new credential fails and the old one worked: send the self test screenshot plus which credential you changed. The most common cause by a distance is scope rather than the rotation — a replacement token issued with narrower grants than the one it replaces, which the pre-flight check will show as an org that is visible with no PRs findable.