A CloudNativePG switchover can record a new primary several seconds before the application has a backend to write to. In CloudNativePG issue #11637, the gap between the operator’s primary status change and the new primary’s Pod label was 3.8–4.8 seconds, with no endpoint for the write Service during that interval. CloudNativePG 1.30.2 fixes one cause of that gap. If you’re rehearsing a rolling PostgreSQL image upgrade, make sustained, acknowledged commits through the application’s normal connection path the acceptance test. Time promotion, Service routing, and client recovery separately so a missed write-downtime budget points to something you can change.
The maintenance trigger is the PostgreSQL Global Development Group’s November 12 update, which addressed 52 security vulnerabilities and more than 140 bugs across the release set. CloudNativePG maintainers released 1.30.2 on November 17, 2026, ahead of 1.31.0. It makes 18.7-system-trixie the default for new clusters that don’t specify an image. An existing cluster still needs a separate change to .spec.imageName or the relevant image catalog to run a patched PostgreSQL image. Plan and measure the operator deployment and the database image rollout as separate events.
Why write routing can lag the primary status update
The write path crosses several layers. PostgreSQL promotes a replica; CloudNativePG records the primary in .status.currentPrimary and updates the Pod’s cnpg.io/instanceRole=primary label; Kubernetes publishes a ready backend for the -rw Service; the client then has to establish or recover a usable connection. A ready endpoint marks backend publication. The Service data path can take longer to converge, and the pool may still hold dead connections.
In CloudNativePG 1.30.1, PostgreSQL could already have stopped on the former primary while its instance manager remained reachable. The manager returned HTTP 500 to the operator’s status request, but the Go errors.As check looked for a StatusError value rather than the returned *StatusError. The operator spent all five attempts on a response it should have treated as final, costing about 1.6 seconds per affected reconciliation. Instance status requests ran sequentially, so that wait delayed the entire reconciliation. Issue #11637 records seven planned switchovers on October 9 on two-instance clusters running CloudNativePG 1.30.1 and Kubernetes 1.35.7 on Microsoft Azure AKS. The missing -rw endpoint left the reported PgBouncer path without a backend. The report did not measure application commits.
In CloudNativePG pull request #11793, the contributor reports that on a two-instance kind cluster, when the former primary’s instance manager returned HTTP 500, the delay from currentPrimary to the primary label fell from about 3.9 seconds to 0.4 seconds, with four switchovers per variant. The interval with no -rw endpoint fell from about 6.4 seconds to 3.1 seconds, based on two baseline runs and four fixed runs. The patch stops retrying non-200 HTTP responses and keeps retries for eligible transport errors. The connection-refused case showed no comparable improvement. Check which failure mode you observed before attributing a shorter write outage to the patch.
How to rehearse a CloudNativePG switchover
Use staging with the same replica topology, replication mode, Service routing, and pool settings as production. Before deploying 1.30.2, check that any custom operator RBAC grants delete on leases in the coordination.k8s.io API group. If you want to isolate the operator fix, hold the PostgreSQL image and workload constant. Run the same planned switchover on 1.30.1 and 1.30.2 after each deployment settles. Record whether the former primary’s instance manager returned HTTP 500 or the request failed at the transport layer. Otherwise, a difference between runs could reflect a change in failure mode rather than the patch.
Then rehearse the actual image rollout without bundling a PostgreSQL parameter change. On a multi-instance cluster, CloudNativePG updates replicas one at a time and handles the primary last. For a supervised rollout, set .spec.primaryUpdateStrategy to supervised. CloudNativePG pauses after the replicas are upgraded; for an image change, manually promote an upgraded replica. Start the watches and both write probes before issuing the promotion command:
kubectl cnpg promote <cluster> <new-primary>
How to measure PostgreSQL write downtime

A promoted primary and a ready Service endpoint are milestones, not proof that clients can commit.
Use a shared time base for the switchover command, Kubernetes observations, and probe results. Record when .status.currentPrimary first names the target, when that Pod first carries cnpg.io/instanceRole=primary, when the first ready -rw backend points to that Pod, and when sustained commits resume through the application. Watch all EndpointSlices selected by kubernetes.io/service-name=<cluster>-rw and verify the target Pod for each relevant endpoint; an endpoint that still points to the former primary does not count as recovery. If you timestamp watch delivery, report those times as observations rather than exact transition times.
Treat currentPrimary as an operator milestone, not a PostgreSQL promotion timer. If the time before that update dominates and you need to distinguish database promotion from delayed status publication, compare it with a PostgreSQL log timestamp that confirms promotion. Likewise, the interval from the primary label to the ready EndpointSlice measures backend publication. To see when writes can actually traverse the Service, keep a separate probe opening fresh PostgreSQL connections through -rw and committing a small write.
Run the acceptance probe through the application’s usual pool and routing path with its existing retry and timeout settings. Start early enough to capture a steady run of successful commits before the transition, and keep both probes running through recovery. Define sustained recovery before the test as a consecutive series of acknowledged commits at the chosen probe cadence. Record the timestamp of the first commit in that qualifying series. A successful connection, a successful read, or a single commit followed by more timeouts each tells you something different; none qualifies as sustained write recovery.
Use a unique transaction ID for each logical write and persist it in the same transaction. If the client loses the commit acknowledgment, check for that ID on the recovered primary before classifying the outcome. A timed-out attempt can have committed, and a retry does not prove the original attempt failed. Track acknowledged successes, failed or timed-out attempts, and any ambiguous outcomes you resolve afterward. Report the last good commit before the gap, the first sustained recovery, and the probe interval. Compare the observed gap with your application’s write-downtime budget, and give the cadence alongside it: probes cannot show what happened between samples, and a blocking timeout can delay the next attempt.
How to attribute delays in a CloudNativePG switchover
If PostgreSQL promotion itself is slow, start with the database and the candidate replica. If promotion is prompt but the operator is slow to publish currentPrimary or apply the primary label, inspect reconciliation and the instance-manager responses. If the label is prompt but the ready endpoint lags, investigate Service selection and endpoint readiness. If the endpoint is present but fresh connections still cannot commit, investigate the Service data path and backend connectivity before tuning the pool. When fresh connections commit consistently and the application still misses writes, inspect how its pool evicts stale connections, how long acquisition and transaction timeouts hold up new work, and when retries run.
How to choose between restart and switchover
Compare a switchover with an automated restart only where the topology and maintenance plan permit either. A switchover promotes a replica that already has the new image, while a restart can place the image pull on the write-outage path. That makes switchover the better candidate when image pull time threatens the budget and an upgraded replica is ready. Still, use the measured application commit gap to decide: a pre-upgraded replica doesn’t help a pool that takes too long to reconnect. Account separately for the operator upgrade, which normally rolls instance managers unless in-place manager updates are enabled, when estimating how many interruptions the maintenance could cause.

Mark recovery when commits succeed consistently through the application’s normal connection pool.
A passing application probe confirms write recovery. Before closing the maintenance window, verify the running PostgreSQL version on each instance, using an instance-specific connection for SHOW server_version; rather than querying -rw repeatedly. Then confirm that the former primary has rejoined as a healthy replica.