PostgreSQL on Kubernetes · CNPG · Zalando · Crunchy PGOCloudNativePG · Local NVMe CSI · Barman S3 · Pooler CRDs
PostgreSQL on Kubernetes Architecture & Operations.
We design, harden, and operate production PostgreSQL clusters on EKS, GKE, AKS, and bare-metal Kubernetes. Our senior engineers combine deep PostgreSQL internals with Kubernetes operator mastery across CloudNativePG (CNPG), Zalando Postgres Operator, and Crunchy Data PGO, complete with dedicated WAL / NVMe CSI storage and Barman Cloud / pgBackRest S3 PITR.
Eliminate cgroup OOMKills, PVC multi-attach stalls, and node-drain outages.
P1 Incident Response
15 mins
24/7 for K8s operator & DB emergencies
Operator Ecosystems
CNPG · Zalando · PGO
Declarative GitOps CRDs with native Kubernetes lease consensus
Storage Architecture
NVMe CSI + WAL Split
Shared-nothing zone-pinned PVCs with dedicated walStorage volumes
Disaster Recovery
Barman Cloud + pgBackRest
Continuous S3/GCS/Azure WAL shipping plus VolumeSnapshot PITR
Selected clients
01 · Why Stateful PostgreSQL Breaks on Unhardened Kubernetes
Six Kubernetes database failure modes we engineer out.
Kubernetes was originally built for stateless pods. Running high-throughput PostgreSQL on Kubernetes requires aligning Linux cgroup memory accounting, CSI storage semantics, and node lifecycle hooks with PostgreSQL internals.
Kubernetes Production Symptom
Architectural Root Cause
JusDB Engineering Remediation
PostgreSQL pods get OOMKilled by kubelet during parallel queries or checkpoints
Kubernetes cgroup memory limits count Linux page cache and PostgreSQL shared memory together; if shared_buffers + (work_mem * active sorts) + page cache exceed resources.limits.memory, the Linux OOM killer terminates the postmaster.
Run PostgreSQL pods with dedicated QoS resource allocations (requests == limits) on isolated database node pools, size shared_buffers to 25-30% of container memory, and cap max_connections behind a Pooler CRD.
Cluster node drain (kubectl drain / Karpenter) takes down primary and standby together
Missing PodDisruptionBudgets (PDB), soft podAntiAffinity rules, or single-AZ PVC topology constraints allow the Kubernetes scheduler to co-locate cluster instances on the same worker node.
Enforce requiredDuringSchedulingIgnoredDuringExecution podAntiAffinity across kubernetes.io/hostname and topology.kubernetes.io/zone, and configure operator-managed PDBs so drains trigger controlled switchovers first.
Multi-attach PVC errors stall failover for 6 to 10 minutes after worker node crash
Network-attached cloud block volumes (AWS EBS, GCP PD, Azure Disk) remain attached to an unresponsive worker node until Kubernetes VolumeAttachment timeouts expire.
Use CloudNativePG / Zalando / PGO architectures where each PostgreSQL instance owns an independent PVC (shared-nothing storage) and failover promotes a streaming standby immediately without re-mounting the dead node's disk.
High WAL fsync latency on default cloud CSI StorageClasses
PGDATA and pg_wal share a single baseline CSI volume with untuned ext4/xfs mount options (barrier overhead, atime updates) and low IOPS limits.
Provision dedicated high-IOPS StorageClasses (gp3/io2, pd-ssd/hyperdisk, or local NVMe via TopoLVM/OpenEBS LVM) with separate walStorage PVCs and noatime mount options.
Object-store WAL archiving silently fails after IAM / IRSA token rotation
Barman Cloud, pgBackRest, or WAL-G containers lose S3/GCS/Azure Blob write permissions after Kubernetes ServiceAccount annotation changes, causing pg_wal to fill the primary PVC.
Wire EKS IRSA, GKE Workload Identity, or AKS Managed Identity with continuous Prometheus alerts on cnpg_collector_up, archive_failed_count, and PVC disk utilization.
Unpinned container image tags trigger unintended minor upgrades during pod reschedule
Specifying floating tags (such as postgres:16) causes newly scheduled standby pods to pull a newer image digest or incompatible extension version during node scale events.
Pin immutable image digests or CloudNativePG ImageCatalog CRDs, and manage rolling minor upgrades through declarative operator rollout strategies.
02 · Kubernetes PostgreSQL Workstreams
Full-stack ownership across PostgreSQL and Kubernetes.
Most platform engineers know Kubernetes but not PostgreSQL internals; most traditional DBAs know SQL but not CSI drivers or CRDs. Our engineers bridge both layers seamlessly.
01
Operator Selection & Production CRD Design
We architect and deploy CloudNativePG (CNPG), Zalando Postgres Operator, or Crunchy Data PGO on EKS, GKE, AKS, and bare-metal OpenShift / Talos clusters.
CloudNativePG vs Zalando vs Crunchy PGO trade-off and fit assessment
Production Cluster CRDs with pinned QoS (requests == limits), node Taints/Tolerations, and anti-affinity
Custom container image builds bundling pgvector, PostGIS, TimescaleDB, and pgaudit
Database performance on Kubernetes lives or dies at the storage and node layer. We engineer CSI StorageClasses and dedicated worker node groups for low-latency I/O.
Dedicated walStorage PVC separation for write-ahead logs
Local NVMe RAID / LVM provisioning (TopoLVM, OpenEBS) and cloud gp3/io2 CSI tuning
When using fast local NVMe or zone-pinned PVCs, object-store backups are your primary durability anchor. We build and test continuous WAL archiving and PITR pipelines.
CloudNativePG Barman Cloud Plugin & ObjectStore CRD setup on S3, GCS, or Azure Blob
Crunchy PGO pgBackRest and Zalando WAL-G multi-repo backup configurations
Automated recovery bootstrap clusters to verify PITR restores on a schedule
We deploy operator-managed PgBouncer Pooler CRDs and Kubernetes Service topologies (-rw, -ro, -r) so microservice pods never overwhelm PostgreSQL backends.
CloudNativePG Pooler CRD and Crunchy/Zalando PgBouncer transaction pooling
TLS mTLS certificate rotation between application pods, PgBouncer, and PostgreSQL
Cross-cluster or external client routing via Envoy, Cilium, or cloud NLBs
Migrating from RDS/Aurora/Cloud SQL into Kubernetes for cost or multi-cloud portability? Or upgrading K8s PostgreSQL from 13/14 to 16/17? We execute rehearsed cutovers.
CNPG externalClusters bootstrap from RDS, Aurora, Cloud SQL, or legacy VMs
Declarative offline pg_upgrade or low-downtime logical replication upgrades
GitOps workflow integration with ArgoCD, Flux, and Kustomize
CloudNativePG vs Zalando vs Crunchy PGO & P1-P3 response.
We support all three major open-source Kubernetes PostgreSQL operators and help you standardize on the right architecture, backed by published P1-P3 SLA response times.
Kubernetes Operator
Pod & Storage Architecture
Failover Consensus
Backup & PITR Ecosystem
Primary Sweet Spot
CloudNativePG (CNPG)
Native Kubernetes controller managing Pods & PVCs directly (no StatefulSet)
Kubernetes API Server Lease + native PostgreSQL replication coordinator
Barman Cloud Plugin (ObjectStore CRD) + VolumeSnapshot support
Modern cloud-native teams seeking CNCF governance, clean GitOps CRDs, and VolumeSnapshots
Zalando Postgres Operator
StatefulSet + Spilo container bundling PostgreSQL and HA orchestration
Kubernetes Endpoints / ConfigMaps or etcd DCS leader locks
WAL-G / WAL-E continuous archiving to S3, GCS, or Azure
Platform teams operating hundreds of standardized multi-tenant PostgreSQL clusters
Response means an on-call engineer is working the incident, not an automated reply. JusDB's security practices are aligned with ISO 27001 and SOC 2 Type II, and JusDB is pursuing both certifications (see Terms, section 12). Review SLA & legal terms.
04 · Interactive Kubernetes Operator Lifecycle
See how CloudNativePG handles node drains and S3 PITR recovery.
Step through a 3-AZ postgresql.cnpg.io/v1 cluster during steady state, a graceful Kubernetes worker node drain coordinated by PodDisruptionBudgets, and automated Point-In-Time Recovery verification.
cnpg-prod-cluster · K8s Operator State Machine
Select a lifecycle stage to inspect kubectl cnpg status and operator logs
Application and routing
A 3-instance CloudNativePG cluster runs across three worker Availability Zones on dedicated NVMe nodes with synchronous quorum replication and Barman S3 WAL archiving.
Active
A 3-instance CloudNativePG cluster runs across three worker Availability Zones on dedicated NVMe nodes with synchronous quorum replication and Barman S3 WAL archiving.
Application and routing
When cluster autoscaler or OS patching drains worker node ip-10-0-1-42 hosting pg-core-1, the PodDisruptionBudget blocks raw eviction and triggers a clean CNPG switchover to pg-core-2 first.
Active
When cluster autoscaler or OS patching drains worker node ip-10-0-1-42 hosting pg-core-1, the PodDisruptionBudget blocks raw eviction and triggers a clean CNPG switchover to pg-core-2 first.
Application and routing
To verify disaster recovery readiness, a scheduled Kubernetes pipeline boots a recovery Cluster CRD from Barman S3 backups to a target timestamp and runs checksum queries.
Active
To verify disaster recovery readiness, a scheduled Kubernetes pipeline boots a recovery Cluster CRD from Barman S3 backups to a target timestamp and runs checksum queries.
05 · Representative Production Deliverable
CloudNativePG (postgresql.cnpg.io/v1) Cluster manifest with Barman S3.
Every Kubernetes engagement delivers GitOps-ready YAML and Helm manifests. Below is an excerpt of a production postgresql.cnpg.io/v1Cluster manifest with strict zone anti-affinity, dedicated walStorage, pg_stat_statements, and Barman Cloud S3 WAL archiving.
Kubernetes PostgreSQL platform build, cloud repatriation, or managed DBA.
Partner with senior engineers fluent in both PostgreSQL internals and Kubernetes operators for a fixed-scope platform build, an architecture audit, or retained operations.
Platform EngineeringRecommended
K8s PostgreSQL Operator Build
We design and deploy a production CloudNativePG, Zalando, or Crunchy PGO platform on EKS, GKE, AKS, or bare metal with Pooler CRDs, Barman S3 PITR, and Prometheus monitoring.
Is running production PostgreSQL on Kubernetes safe for stateful OLTP workloads?
Yes, when engineered with a mature operator (CloudNativePG, Zalando Postgres Operator, or Crunchy Data PGO), dedicated database worker node pools, pinned QoS resource allocations (requests equal to limits), shared-nothing per-instance PVCs across three Availability Zones, and continuous WAL archiving to S3/GCS/Azure Blob. Most Kubernetes database incidents happen when teams deploy generic StatefulSet Helm charts on burstable shared application nodes without PodDisruptionBudgets or proper CSI storage tuning.
Should we choose CloudNativePG (CNPG), Zalando Postgres Operator, or Crunchy Data PGO?
CloudNativePG (CNPG) is our most frequent recommendation for greenfield Kubernetes platforms: it is a CNCF Sandbox/Incubating project built by enterprise PostgreSQL contributors, manages pods and PVCs directly via the Kubernetes API without StatefulSet limitations, and supports native Kubernetes VolumeSnapshots plus Barman Cloud object storage. Zalando Postgres Operator is battle-tested for large platform teams running hundreds of Spilo clusters, while Crunchy Data PGO is ideal for organizations standardized on pgBackRest differential backup repositories.
How do you prevent kubelet from OOMKilling PostgreSQL pods under heavy query load?
In Kubernetes, container memory limits enforce a hard cgroup ceiling that includes PostgreSQL shared_buffers, per-backend work_mem allocations, backend process RSS, AND the Linux kernel page cache for that cgroup. We configure PostgreSQL pods with dedicated QoS resource settings (resources.requests equal to resources.limits), cap shared_buffers at 25% of the container limit, enable huge_pages where supported on the node pool, enforce strict work_mem and max_connections limits, and place a PgBouncer Pooler CRD in front of the cluster.
Should we use cloud network block storage (EBS/PD) or local NVMe SSDs for Kubernetes PostgreSQL?
Both work well when matched to the right failure model. Cloud CSI block storage (AWS EBS gp3/io2, GCP Persistent Disk / Hyperdisk, Azure Premium SSD v2) persists independently of the worker VM, making node replacement straightforward. Local NVMe SSDs (via TopoLVM or OpenEBS LVM on i3en/i4i or N2-local-SSD nodes) deliver 5x to 10x lower I/O latency and zero per-IOPS cloud surcharges, provided you run at least 3 synchronous quorum replicas across zones and continuous Barman Cloud / pgBackRest backups to object storage.
How do connection pooling and service discovery work with CloudNativePG?
CloudNativePG automatically maintains three Kubernetes Services for every cluster: <cluster>-rw pointing exclusively to the current primary pod, <cluster>-ro load-balancing across hot standbys, and <cluster>-r across all instances. To handle high connection concurrency, we deploy the native CNPG Pooler CRD, which spins up horizontal PgBouncer deployments wired with automatic mTLS certificates and seamless failover awareness.
How do you migrate from Amazon RDS, Aurora, or Cloud SQL into a Kubernetes PostgreSQL operator?
We use a two-step continuous replication workflow: first, we bootstrap the Kubernetes PostgreSQL cluster (or configure logical replication subscriptions) pulling from your existing RDS, Aurora, or Cloud SQL instance over VPC peering; second, once initial sync completes and replication lag drops to near-zero, we run row-hash parity checks and switch application Kubernetes ExternalName Services or ingress poolers to the local in-cluster Pooler service.
How are minor and major PostgreSQL version upgrades handled on Kubernetes?
For minor version upgrades (for example, 16.4 to 16.6), updating the imageName or ImageCatalog reference triggers a rolling update: the operator upgrades each standby pod one at a time, waits for streaming replication to catch up, and then executes a supervised switchover to upgrade the former primary last. For major version upgrades (14/15 to 16/17), we use declarative offline pg_upgrade jobs or blue/green logical replication between two Cluster CRDs.
What SLA response times apply to managed PostgreSQL on Kubernetes support?
24/7 support. SLA response times: P1 – 15 mins | P2 – 30 mins | P3 – 60 mins. Our engineering team is in India (IST, UTC+5:30) and provides 24/7 support. Response means an on-call engineer is working the incident, not an automated reply.
08 · Related PostgreSQL Services & Playbooks
Explore adjacent HA, pooling & cloud migration services.
Connect your Kubernetes PostgreSQL platform with PgBouncer connection pooling, high availability design, and cloud repatriation.
Run stateful PostgreSQL on Kubernetes with confidence.
Speak directly with a senior Kubernetes PostgreSQL architect to review your CloudNativePG, Zalando, or Crunchy PGO manifests, CSI storage layout, and Barman backup pipeline.