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
- Unknown KEK kid
- decryption operation failed
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.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.
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.
3. If the key is unrecoverable, purge the unusable rows
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
- PostgreSQL
- MongoDB
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.Only the
- PostgreSQL
- MongoDB
OrgKeyrings is the only mixed-case identifier in the schema: the double quotes are mandatory.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 kidordecryption operation failedleft in the logs of the three services; - a throwaway automation chaining
secrets.set,secrets.getand afetchusing the returned$secret:reference; - a real SSO login on each organization whose configuration was re-entered.