Skip to content

Postgres Remote Replica Docs for Data Center Failover + Failback - #910

Merged
souravbiswassanto merged 4 commits into
masterfrom
remote-replica-pg
Aug 19, 2026
Merged

Postgres Remote Replica Docs for Data Center Failover + Failback#910
souravbiswassanto merged 4 commits into
masterfrom
remote-replica-pg

Conversation

@souravbiswassanto

@souravbiswassanto souravbiswassanto commented Jun 24, 2026

Copy link
Copy Markdown
Member

Signed-off-by: souravbiswassanto saurov@appscode.com

Summary by CodeRabbit

  • New Features
    • Added a complete PostgreSQL cross-cluster disaster recovery guide with bidirectional failover.
    • Added deployment manifests for Singapore and London PostgreSQL clusters and remote replicas.
    • Added TLS certificate issuance and secure authentication configuration.
    • Configured three-replica, hot-standby PostgreSQL 17.4 clusters with durable storage.
  • Documentation
    • Documented replication setup, failover, recovery, failback, validation, and cleanup procedures.

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

gitguardian Bot commented Jun 24, 2026

Copy link
Copy Markdown

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
34236755 Triggered Username Password 15ad7b4 docs/guides/postgres/remote-replica/advanced-setup-yamls/pg-singapore-auth.yaml View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8e2f74e9-00be-4cc8-9a70-48a814d6df75

📥 Commits

Reviewing files that changed from the base of the PR and between d9a1f1a and b5bd6d7.

📒 Files selected for processing (6)
  • docs/guides/postgres/remote-replica/advanced-setup-yamls/pg-issuer.yaml
  • docs/guides/postgres/remote-replica/advanced-setup-yamls/pg-london-remote-replica.yaml
  • docs/guides/postgres/remote-replica/advanced-setup-yamls/pg-london.yaml
  • docs/guides/postgres/remote-replica/advanced-setup-yamls/pg-singapore-remote-replica.yaml
  • docs/guides/postgres/remote-replica/advanced-setup-yamls/pg-singapore.yaml
  • docs/guides/postgres/remote-replica/advanced-setup.md

📝 Walkthrough

Walkthrough

Adds a PostgreSQL cross-cluster disaster recovery guide with shared TLS setup, Singapore and London manifests, bidirectional remote replication, failover, recovery, failback, validation, and cleanup procedures.

Changes

PostgreSQL remote replica disaster recovery

Layer / File(s) Summary
Shared cluster and TLS setup
docs/guides/postgres/remote-replica/advanced-setup.md, docs/guides/postgres/remote-replica/advanced-setup-yamls/pg-issuer.yaml
Documents shared CA and authentication secrets, cert-manager issuers, namespaces, and ingress TCP exposure.
Primary PostgreSQL clusters
docs/guides/postgres/remote-replica/advanced-setup-yamls/pg-singapore.yaml, docs/guides/postgres/remote-replica/advanced-setup-yamls/pg-london.yaml, docs/guides/postgres/remote-replica/advanced-setup.md
Adds PostgreSQL 17.4 HA manifests and documents Singapore primary deployment, readiness checks, test data, and intra-cluster replication.
Cross-cluster replication
docs/guides/postgres/remote-replica/advanced-setup-yamls/*remote-replica.yaml, docs/guides/postgres/remote-replica/advanced-setup.md
Adds London and Singapore remote-replica manifests and documents TLS client configuration, WAL streaming, data checks, and lag monitoring.
Failover and failback
docs/guides/postgres/remote-replica/advanced-setup.md
Documents London promotion, Singapore recovery, failback to Singapore, topology restoration, final validation, cleanup, and operational references.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Operator
  participant pg-singapore
  participant pg-london
  participant Coordinator
  pg-singapore->>pg-london: Stream cross-cluster WAL
  Coordinator->>pg-london: Check replication lag
  Operator->>pg-singapore: Delete failed primary
  Operator->>pg-london: Promote to standalone primary
  pg-london-->>Operator: Report ready and writable
  Operator->>pg-singapore: Redeploy as remote replica
  pg-london->>pg-singapore: Stream recovered WAL
Loading

Possibly related PRs

  • kubedb/docs#1038: Extends related PostgreSQL cross-cluster replication documentation with synchronous replication.
  • kubedb/docs#1040: Updates related PostgreSQL remote-replica documentation with cross-cluster TLS configuration.

Suggested reviewers: kodiak-appscode

✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch remote-replica-pg

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown

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

https://kubedb-v2-hugo--pr910-remote-replica-pg-ru0wd5gj.web.app

(expires Wed, 12 Aug 2026 10:30:00 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 0f29ae8ae0bd54a99bf2b223b6833be47acd5943

Re-ran the full guide end to end (setup, failover, reattach, failback) against
the release PR stack before making these changes; every edit below states what
that run actually showed.

- Remote replica pod listings corrected from 1/1 to 2/2, and the "no
  coordinator" sentence replaced: remote replicas now run a pg-coordinator
  sidecar (no Raft) that handles pg_rewind/re-seed recovery, keeps the standby
  role label truthful, and logs replication lag.
- deletionPolicy switched from Delete to Halt throughout. With retained PVCs
  the return legs of failover/failback reattach to existing data: ex-standbys
  follow the timeline history and the former primary is repaired in place with
  pg_rewind -- observed directly, no full re-seed on any of the six reattaching
  pods. With Delete every return leg silently re-seeds from scratch.
- Removed the 11.1 "may stay NotReady, restart the pod" workaround note: the
  underlying promote issue is fixed by the init-container promote-before-writes
  change, and eight consecutive promotions across test cycles never reproduced
  it.
- remote-config commands fixed: -y is a boolean confirmation skip, not an
  output filename; the output path is fixed to <dbname>-remote-config.yaml in
  the current directory. Added the -d host:port / --port note.
- Auth secrets are now created from a shell variable instead of committed YAML
  files; the two files carrying a literal password are removed.
- Step 8 gains the coordinator's lag-monitor log as a verification signal;
  Step 10 explains the retained-PVC reattach and the log lines to expect.
- pg-singapore-remote-replica.yaml now references pg-singapore-auth for
  coherence (previously it pointed at pg-london-auth and only worked because
  both passwords must match).

Signed-off-by: Tamal Saha <tamal@appscode.com>
Verified by a clean-room run of the guide exactly as written (fresh namespaces
and CA, every step 1-11 from the guide's own files and commands; all sample
counts reproduced 1000 through 1005 with no manual intervention). Two
hardenings from that run: note that Raft may elect any pod as primary since
the examples assume pod 0, and create the auth secrets with --save-config so
the later kubectl apply from remote-config does not warn about a missing
last-applied annotation.

Signed-off-by: Tamal Saha <tamal@appscode.com>
@souravbiswassanto
souravbiswassanto marked this pull request as ready for review August 19, 2026 04:46
@souravbiswassanto
souravbiswassanto merged commit d1732dd into master Aug 19, 2026
7 of 9 checks passed
@souravbiswassanto
souravbiswassanto deleted the remote-replica-pg branch August 19, 2026 04:47
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.

2 participants