A hands-on walkthrough for setting up CloudNativePG (CNPG) distributed topology across multiple Kubernetes clusters for PostgreSQL disaster recovery. The guide covers configuring ObjectStore custom resources using MinIO (as a stand-in for S3/GCS), deploying a primary cluster with WAL archiving via the barman-cloud plugin, and bootstrapping a replica cluster that polls the same object store to stay in sync. Key YAML manifests are provided for both clusters, along with actual kubectl cnpg status output showing healthy replication. Important operational notes include monitoring object-store latency (since replication depends on WAL shipping rather than direct streaming), keeping PostgreSQL and operator versions in sync across clusters, and understanding how declarative role matching enables clean switchovers without topology changes.

8m read timeFrom cybertec-postgresql.com
Post cover image
Table of contents
Why CNPG Distributed Topology?The Architecture at a GlanceKey Elements in the YAMLStep-by-Step Deployment WorkflowLessons Learned & GotchasWrapping Up
2.4K Impressions