Install
Backup and restore
Take a logical dump of the control plane's store, restore it, move it to another Postgres, and bring the install key with it.
In short
opodcp backup writes the control plane's whole database to one JSON-lines file, and opodcp restore reads it back into an empty database. Endpoints keep serving while you do either. Keep the install key next to every backup: without it the stored connector credentials cannot be opened. opodcp store move copies the database to another Postgres and checks the copy.
When you need it
- You want a nightly backup of the control plane, kept with your other database backups.
- You upgrade across a schema step and need a way back.
- You lost the database, or rebuilt the cluster, and must bring back endpoints, keys and history.
- You move the control plane's database to another Postgres server.
Do it
Take a backup
export H="Authorization: Bearer $(kubectl -n opodcp get secret opodcp-admin -o jsonpath='{.data.token}' | base64 -d)" curl -sf -H "$H" https://cp.example.com/api/v1/backup -o opodcp-$(date -u +%F).jsonl chmod 600 opodcp-$(date -u +%F).jsonlSave the install key beside it
kubectl -n opodcp get secret opodcp-install-key -o jsonpath='{.data.keys}' | base64 -d > install-key-$(date -u +%F).txt chmod 600 install-key-$(date -u +%F).txtThe install key is new in
0.3.0.Store both off the cluster
Copy both files to encrypted storage with short retention. A backup holds key hashes and session hashes.
To restore, follow Restore below.
Check it worked
head -c 300 opodcp-$(date -u +%F).jsonl; echo
wc -l opodcp-$(date -u +%F).jsonlA good backup starts with the header line {"opodcp_backup":1,"at":"…","tables":[…]} and has one more line per row. After a restore, the command prints one count per table, in name order, and a total on stderr, and the audit chain verifies:
restored into OPODCP_STATE_DSN (postgres://o…)
alert_rules 2
…
endpoints 3
…
total 5210 rowscurl -s -H "$H" https://cp.example.com/api/v1/audit/verify | jq '{ok, entries, headSeq}'
# {"ok": true, "entries": 1830, "headSeq": 1830}The console's Audit log → Chain card shows the same verification, and Settings → Backup downloads a backup.
If it fails
| Message | Cause | Fix |
|---|---|---|
restore: not an opodcp backup (header "…") | the file is not a backup, or it is an HTML error page | take the backup again; check that curl got a 200 (-f) |
restore: endpoints row 1: … (a duplicate key) | the target store is not empty | restore into an empty database, or pass --wipe |
restore: this store already holds an audit chain … restore with --wipe | two audit chains cannot be merged | pass --wipe, which replaces the store, chain included |
store schema N was written by a newer opodcp | the backup came from a newer release | restore with that release or a newer one |
restore into the target (it must be empty): … from store move | the target holds state | point --to at an empty database |
Alert connector.sealed after the restore | the release minted a new install key | install with --set installKey.existingSecret=… naming the key you saved |
The backup request answers 403 | the token is not an admin's | use the admin token or an admin user's session |
What the store holds
The control plane's database holds endpoints and every plan revision, models and their versions, API key hashes, users and sessions, alerts and rules, runs, stream cursors, the journal, leader events, usage facts, policies and settings, and the audit hash chain. Leaders and workers keep nothing but the model weight cache.
Losing the store loses governance, not serving: every endpoint keeps answering from its mounted files. Restoring the store brings back the management view, keys, policies and history, and the reconciler then re-applies each restored plan within a minute.
What a backup is
opodcp backup writes one logical JSON-lines file: a header line, then one line per row of every table, in a fixed order, with nothing dialect-specific.
{"opodcp_backup":1,"at":"2026-10-30T23:40:00Z","tables":["endpoints","plans",…]}
{"table":"endpoints","row":{"id":"ep_…","name":"chat",…}}It holds every table the schema creates except opodcp_schema (the schema's own history: the target store writes its own), ledger and usage_ingest (counters that a restore moves forward) and stream_tickets (single-use credentials that expire in seconds). The audit chain is dumped and restored link for link, so GET /api/v1/audit/verify passes after a restore.
A backup holds secrets — key hashes, remote vendor keys, session hashes. Treat it like the store: mode 0600, encrypted at rest, short retention. Connector credentials in it are sealed with the install key.
Take a backup
| From | Command |
|---|---|
| a shell with the control plane's environment | opodcp backup -o opodcp-2026-10-30.jsonl (-o - streams to stdout) |
| the API, with an admin token | curl -H "Authorization: Bearer <admin token>" https://cp.example.com/api/v1/backup -o opodcp.jsonl |
| the console | Settings → Backup → Download backup (admin) |
| inside the pod | kubectl -n opodcp exec deploy/opodcp -- /opodcp backup -o - > opodcp.jsonl |
A backup can run while the control plane serves. Reads are consistent per statement and the control tables are small; for a point-in-time copy of a busy store, use pg_dump as well. Nightly is enough: the store changes on operator actions, not on request traffic. A CronJob that calls /api/v1/backup with an automation token and ships the file to object storage is the usual shape.
Keep the install key with the backup. Every connector credential in the store is sealed with it. Save the Secret <release>-opodcp-install-key next to your database backups.
Restore
Stop the writer
kubectl -n opodcp scale deploy/opodcp --replicas=0Leaders keep serving.
Point at the target store
Set
OPODCP_STATE_DSN=postgres://…asservewould. An empty database is fine; the schema is created on open. Restore with the binary that wrote the dump or a newer one, never an older one: a store a newer release wrote is refused.Restore
opodcp restore opodcp-2026-10-30.jsonl # into an empty store opodcp restore --wipe opodcp-2026-10-30.jsonl # empty every table first; asks on a terminal opodcp restore --wipe --yes opodcp-2026-10-30.jsonl # in a script or a Job (the release after 0.3.6)Without
--wipea non-empty store is refused on the first conflicting row; there is no silent merge. A store that already holds an audit chain refuses a dump that carries one unless you pass--wipe.Bring the install key
Install with
--set installKey.existingSecret=<the Secret you kept>. A release installed without it mints a new key; the sealed settings are then not applied, and the alertconnector.sealednames, per port, the key id each setting needs and the one it holds. Give it the old key (or both, comma-separated, while you move), or enter the credentials again on the Connectors page.Start
kubectl -n opodcp scale deploy/opodcp --replicas=1Within one reconcile (60 s) every plan is re-applied, auth and policy Secrets are rewritten, and usage cursors resume.
Over the API: POST /api/v1/restore?wipe=1 with the dump as the body (admin). Use it only when nothing else writes. The console downloads backups but does not restore.
A new cluster under a kept store. If the store is kept and the cluster is rebuilt (or every object of an endpoint is deleted), an endpoint with no pods whose last deployment had succeeded is re-created from its plan, and the activity feed says endpoint.recreated.
Move the store to another Postgres
kubectl -n opodcp scale deploy/opodcp --replicas=0
opodcp store move --to-file /run/secrets/target-dsn # or --to postgres://host/dbIt reads the store serve opens (OPODCP_STATE_DSN, so run it where that is set, for example in a Job with the release's environment), refuses the store it already uses and a target that already holds state, restores into it, then compares every table's row count and the audit chain's head. The source is untouched. If it stops part way (move stopped: …), the target may be partly written: empty it before you run store move again. Postgres to Postgres only. Point the release at the target (ports.state.dsnSecret), then scale back to 1. Prefer --to-file when the DSN carries a password, so it stays off the command line.
What a connector switch moves
| Port | When you switch its adapter |
|---|---|
state | a new store starts empty: move it with opodcp store move |
usage | nothing to do: a new sink is sent every row the spool still keeps, oldest first |
secrets | a new store records tokens from then on; opodcp secrets sync records every token the Kubernetes Secrets hold now |
batchfiles | files in the old bucket are not moved; let running batches finish first |
checkpoints | checkpoints already written are not moved |
| others | nothing to move |
Last updated · Source: content/docs/control-plane-install/backup-restore.mdx · View as Markdown