Skip to main content
The masterKeys value in the <release>-secrets-encryption Secret is the only way to read encrypted data. This page is the procedure to follow when it is missing or no longer matches what encrypted your data. Back it up before you need it: see Backup & Restore.

1. Identify the failure

The kid is no longer present in masterKeys — the key is missing. Every keyring carrying that kid is equally unreadable, so the impact can be scoped by kid.
Both errors also break writes, not just reads: storing a secret first unwraps the existing keyring, so new secrets fail too.

2. Try to recover the key

As long as a copy exists, recovery is complete and lossless.
1

Read it from the running pods

Environment variables are injected at pod start, so a pod that has not restarted since the loss still holds the key.
Do this before scaling anything down. Stopping the pods destroys this last copy.
2

Check the Helm release history

3

Check the vault, the GitOps repository and the cluster backups

Sealed Secrets, External Secrets Operator and SOPS keep a reproducible copy, as does any backup taken before the loss.
If you find the key, restore it and stop here:

3. If the key is unrecoverable, purge the unusable rows

Irreversible. The encrypted values are already lost; the purge only removes the rows that can no longer be read, so that users can create new secrets. A stale keyring left in place keeps blocking writes in that workspace or organization.
Four objects, spread over two databases:
Leave the secrets table alone: it holds the plaintext {{secret.*}} values declared in a workspace’s configuration, does not depend on any master key, and its name is one word away from secure_secrets.
1

Snapshot both databases

The ciphertext is worthless today, but if the original key resurfaces in an older backup, it is the difference between restoring and having nothing.
2

Stop writes

3

Purge the permissions database

If every master key is lost: TRUNCATE TABLE secure_secrets, workspace_keyrings;
4

Purge the users database

Required as soon as organization SSO providers exist: until the stale organization keyring is removed, the gateway fails on every SSO login and rejects the re-entry of a new configuration.
OrgKeyrings is the only mixed-case identifier in the schema: the double quotes are mandatory.
Only the config field is lost: slug, type, domains and attributesMapping survive, so re-entry is limited to the provider credentials.
5

Restart with a new key

Generate a new pair, restore it as shown in Install with Helm, then bring the services back:
All pods of prismeai-runtime, prismeai-workspaces and prismeai-api-gateway must restart with the same values: a pod still holding the old key would wrap new data keys under a kid the others cannot resolve, and the in-memory caches have to be cleared. New keyrings are created automatically on the next secret write and on the first SSO configuration re-entered.
6

Verify

  • no Unknown KEK kid or decryption operation failed left in the logs of the three services;
  • a throwaway automation chaining secrets.set, secrets.get and a fetch using the returned $secret: reference;
  • a real SSO login on each organization whose configuration was re-entered.

4. What users have to redo