Skip to content

Postgres DC-DR: guides on current master - #1097

Draft
souravbiswassanto wants to merge 20 commits into
masterfrom
dcdr-all
Draft

souravbiswassanto wants to merge 20 commits into
masterfrom
dcdr-all

Conversation

@souravbiswassanto

Copy link
Copy Markdown
Member

All Postgres DC-DR work for this repo combined into one branch, on top of current master, so the whole feature set can be tested together and merged at once. The individual PRs stay open for reference.

Not yet done:

  • Nothing in this branch has been compiled or tested yet (build host unreachable). Do not merge until the build, unit tests and the live DC-DR test pass are green.
  • A non-DC-DR regression review of the combined diff is in progress.

Combines:

…ovision, switchover/failover, scaling and teardown pages

Signed-off-by: souravbiswassanto <saurov@appscode.com>
Signed-off-by: souravbiswassanto <saurov@appscode.com>
- Use placeholder IPs instead of lab addresses; use $SPOKE_1_IP for the k3s TLS SAN.
- Concepts: per-DC PlacementPolicy is named <policy>-<dc>; add the
  spec.monitor limitation for v2026.10.12.
- Provision: warn that databases without a FailoverGroup share the
  default primary-dc scope and move together.
- Teardown: exact cleanup of the orphaned group Lease and marker
  ConfigMaps (dr-controlplane v0.1.0 keeps renewing them); correct the
  deletionPolicy summary; add Before You Begin.
- Scaling: use pg-docs like the other pages and check the active DC first.
- Switchover/failover: add the break-glass apply/delete commands; reword
  test-run references as examples.
- Install: clarify the bundled PetSet CRDs and the cached provisioner image note.

Signed-off-by: souravbiswassanto <saurov@appscode.com>
…t a gap

Signed-off-by: souravbiswassanto <saurov@appscode.com>
Signed-off-by: souravbiswassanto <saurov@appscode.com>
@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Visit the preview URL for this PR (updated for commit cb9b09b):

https://kubedb-v2-hugo--pr1097-dcdr-all-2dswawr9.web.app

(expires Tue, 01 Dec 2026 16:39:09 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 0f29ae8ae0bd54a99bf2b223b6833be47acd5943

The DC-DR major UpdateVersion hands safety-critical steps to the user
(the accept-foreign-reseed ConfigMap on each spoke, scoped to the
upgraded primary's system identifier, and deleting it afterwards), and
no page described them. Concepts also still said only horizontal
scaling was supported on DC-DR.

Add an Update Version page: the minor update, and for the major update
what the request does, its prerequisites, the optional standby-hold,
the scoped accept ConfigMap per spoke and where the request prints the
command, that it waits for it with no time limit, that the standby DC
runs no Postgres between its restart and its re-seed, the cleanup, and
what happens when it stops. List the supported and refused ops request
types in Concepts.

Signed-off-by: souravbiswassanto <saurov@appscode.com>
The DC-DR rewrite deleted distributed/overview, the only guide for a
plain distributed Postgres (one Raft group spread across OCM clusters,
the hub also a spoke). The operator still supports that mode: a
distributed Postgres whose PlacementPolicy has no failoverPolicy stays
plain (dcdr_trigger.go), and the dormant path still cleans up its
single PetSet.

Restore it from master as distributed/plain ("Distributed Postgres
without DC-DR"): say what the mode does and does not give, that a
failoverPolicy turns a database into DC-DR, pin the KubeDB chart to
the docs release, and fix the sample PlacementPolicy's KubeSlice
project namespace. Link it from Concepts and from Provision.

Signed-off-by: souravbiswassanto <saurov@appscode.com>
DC-DR backup, WAL archiving, restore and PITR ship in this release,
but the only backup page was the WAL archive gap one, with no setup
and none of the limitations the code has.

Add a Backup and PITR page: how the full backup, the archiver, the
Secret copies and the restore run on the active data center's spoke;
the addon task and storage it needs; the archiver with the Restic
driver, set at creation; the WALArchiving condition and its reasons
(WaitingForFirstPush until a push is recorded; a Restart fixes an
archiver added later); how to read the PITR range; a restore into a
new DC-DR database; and the limitations: a target after the archived
WAL restores to the latest archived point, a restore across raised
max_* settings needs spec.configuration at least as high, and a
re-restore under a deleted database's name needs its old auth Secret
deleted first. Link it from Concepts and Update Version.

Signed-off-by: souravbiswassanto <saurov@appscode.com>
The install page pinned KubeDB v2026.10.12 (provisioner v0.68.0,
pg-coordinator v0.52.0), which has none of the DC-DR code these pages
now describe (backup and PITR, the monitoring fix, WALArchiveGap, the
DC-DR ops requests). Concepts still said monitoring was not supported
and that backup was not covered.

Pin the KubeDB and KubeStash charts to the docs release and say that
earlier releases lack these features; drop the provisioner and
coordinator version numbers. Replace the monitoring limitation with
how the hub stats Service reaches the pods, and point the backup lines
at the new Backup and PITR page. Say the RPO/RTO measurements are the
numbers of v2026.10.12.

Signed-off-by: souravbiswassanto <saurov@appscode.com>
The docs required one FailoverGroup per database but never said that a
PlacementPolicy must not be shared. KubeDB derives <policy>-<dc> from
it, stamps the owning database on them (last writer wins), deletes
them by those labels with the database, and rewrites the policy's
replicaIndices on horizontal scaling, so a shared policy breaks both
databases.

State on the Provision page that each DC-DR database needs its own
PlacementPolicy and FailoverGroup, and why.

Signed-off-by: souravbiswassanto <saurov@appscode.com>
…ejoins

The pages gate planned operations on protected: true, but for about a
minute after a switchover or failover the hub can report it before the
old data center has rejoined (it still measures the old primary
through the slice name; the page's own switchover sequence shows
protected=true, then Degraded/false). A user who starts a failback or
maintenance in that window can lose data.

Add the warning to Check before you start, with how to confirm the
other data center's crossDCStreamer and lag, and its streamer and slot
on the active primary; refer to it from Failback, the scaling rules
and the protected row in Concepts.

Signed-off-by: souravbiswassanto <saurov@appscode.com>
The sample SliceConfig sets a 5 Mbit/s bandwidth ceiling, copied from
the old overview, with no warning. All cross data center replication
and every cross data center re-seed go over the slice, so above about
640 KB/s of WAL the standby data center falls behind without bound,
and a 100 GiB re-seed takes about 45 hours.

Add a warning on the spoke-clusters page and a comment in the sample
YAML: the value is a demo value; size the slice for the peak WAL rate
plus re-seeds.

Signed-off-by: souravbiswassanto <saurov@appscode.com>
Concepts said a database becomes DC-DR with distributed: true, the
dr.kubedb.com/enabled annotation and a failoverPolicy, and Provision
said that without the annotation distributed: true gives a single
Raft group. The operator stamps the annotation itself whenever the
PlacementPolicy has a failoverPolicy (dcdr_trigger.go); the
annotation is only a manual override. A user who left the annotation
out expecting plain mode got DC-DR, WAL policy override included.

Say that the failoverPolicy is the opt-in, and that plain mode needs a
PlacementPolicy without one.

Signed-off-by: souravbiswassanto <saurov@appscode.com>
The pages said a switchover to the Arbiter stays FailingOver until
aborted. ensureTargetReady refuses a target with no lag report before
the phase changes, so the database stays Steady and the annotation is
retried with only an operator-log error.

Also document what this release added: a switchover does not start
while an ops request of the database is Progressing; DC-DR ops
requests that restart pods step aside (fail) when a switchover,
failover or failback starts; a major UpdateVersion does not, so a
switchover requested during one waits for it to finish.

Signed-off-by: souravbiswassanto <saurov@appscode.com>
Concepts and the switchover page promised zero acknowledged-write loss
for a planned switchover. The handoff gate allows 8 KiB of unreplayed
WAL by default, which the code calls an engineering default, not a
proof (pkg/dcdr/helpers.go); the strict reading needs the annotation
set to 0.

Say that no acknowledged write was lost in testing, that the handoff
allows up to 8 KiB of residual WAL, and how to require an exact
catch-up.

Signed-off-by: souravbiswassanto <saurov@appscode.com>
The sample Postgres set walKeepSize: 1536, which overrides the DC-DR
default of 8192 that the operator stamps only when the field is unset
(dcdr_trigger.go, raised from 1536 on purpose), so a user copying the
sample gets standbys that re-seed sooner.

Use 8192 in the Provision sample, its YAML and the switchover snippet,
and say that these are the defaults the operator sets.

Signed-off-by: souravbiswassanto <saurov@appscode.com>
…a switchover

The pages implied that after the Lease handoff the old primary becomes
a standby at once. In this release it stays up, write-locked, for
about 100-130 s (awaitCrossDCDrainBeforeDemoteShutdown waits for the
new primary's DC to stream before the demote shutdown), so the
"exactly one pod with kubedb.com/role=primary" check can fail in that
window.

Note the delay in Concepts and on the switchover page, and that the
primary-label check, also in Troubleshooting, should run after it.

Signed-off-by: souravbiswassanto <saurov@appscode.com>
Teardown recommended Halt to keep the data but said nothing about
what follows. cleanupDistributedManifestWorks keeps the PVC
ManifestWorks (unless Delete or WipeOut) and the auth/TDE Secret
ManifestWorks (unless WipeOut) in the cluster namespaces, and
re-creating a DC-DR database over halted data is untested.

List the ManifestWorks that remain, state that re-creating from halted
data is not covered in this release, and show how to find and delete
them once the data is no longer needed.

Signed-off-by: souravbiswassanto <saurov@appscode.com>
… check

The DC-DR guides ship FailoverGroup (apps.k8s.appscode.com/v1) and
ServiceExport (networking.kubeslice.io/v1beta1) samples; register their
CRDs so codespan-schema-checker can validate them.

Signed-off-by: souravbiswassanto <saurov@appscode.com>
kubeadm-config is a kubeadm configuration, not a Kubernetes object, so the
docs CI manifest check cannot validate it. Keep the same content under a
.conf name, which the check skips.

Signed-off-by: souravbiswassanto <saurov@appscode.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant