Skip to content

[Bug]: Healthy primary removed from -rw when its node loses API-server connectivity, no failover (136 s write outage) #11656

Open

Description

@PeterZaitsev

Is there an existing issue already for this bug?

  • I have searched for an existing issue, and could not find anything. I believe this is a new bug.

I have read the troubleshooting guide

  • I have read the troubleshooting guide and I think this is a new bug.

I am running a supported version of CloudNativePG

  • Yes

Version

1.30 (1.30.1)

What version of Kubernetes are you using?

1.35

What is your Kubernetes environment?

Self-managed: k3s v1.35.9+k3s1, 1 tainted control-plane + 3 workers (2 vCPU / 4 GB), local-path storage

How did you install the operator?

YAML manifest (cnpg-1.30.1.yaml); plugin-barman-cloud v0.15.1 manifest; cert-manager v1.21.2

What happened?

When the node running the primary loses its connection to the API server but the pod network stays up (in our test the kubelet's connection to the API server was cut; pods on that node could still reach the API server and their peers through the overlay), the node goes NotReady. Kubernetes then marks the primary pod not ready, and it is removed from cluster-example-rw. The primary itself stays healthy and keeps accepting local writes, and the operator does not fail over (phase stays Cluster in healthy state), because the instance manager is still reachable.

Result: 136 s of write outage through -rw with a healthy primary and no failover, until the node became Ready again.

For comparison, a Patroni-based operator on the same nodes (Percona Operator for PostgreSQL 3.1.0, whose primary Service endpoints are written by Patroni rather than selected by readiness) had no write interruption in the same test.

Reproduction: on the primary's worker, drop host traffic to the API server's IP (iptables -I OUTPUT -d <apiserver-ip> -j DROP, plus INPUT) for ~3 minutes, while flannel's VXLAN keeps using another interface or IP. Run a write probe against cluster-example-rw.

Expected: either fail over (the primary is effectively unreachable to clients), or keep the -rw endpoint while the instance manager reports a healthy primary, or at least document this failure mode in failure_modes/failover.

Cluster resource

# docs/src/samples/cluster-example.yaml (1.30), plus a barman-cloud plugin entry

Relevant log output

+53s node=NotReady currentPrimary=cluster-example-3 phase="Cluster in healthy state"
... (unchanged until the partition is removed at +180 s)
probe: +45.6s .. +181.4s  write failures "Is the server running on that host and accepting TCP/IP connections?"
local socket on the primary during the same window: INSERT 0 1 (keeps succeeding)

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. PeterZaitsev commented on Oct 14, 2026

    @PeterZaitsev
    Author

    Follow-up from a related test on the same 1.30.1 lab, which is a stricter variant of this report:

    • Host of the primary's node: the kubelet/agent loses the API server (OUTPUT to the control plane on 6443 dropped). The node goes NotReady after about 45 s.
    • Primary pod (in its netns): the API server (10.43.0.0/16) is unreachable, and 5432 to and from both replicas is dropped. Port 8000 between pods is left open.

    Result over a 300 s fault:

    • No failover. currentPrimary and targetPrimary stayed unchanged, and the phase stayed Cluster in healthy state throughout.
    • The primary logged Primary lease lost, cannot verify holder, retrying and was never restarted.
    • Sessions opened before the fault kept committing normally: 13,305 acknowledged writes, none lost.
    • New connections through -rw failed from +44.9 s until the fault was removed, 264 s in total.

    So there was no split-brain, but the cluster spent the whole fault with a primary that is healthy yet unreachable for new clients, and no failover happened. That matches the 136 s outage in the original report. For comparison, Patroni (Percona Operator 3.1.0) under the same fault demoted the old primary at +10.5 s and promoted a new one at +21.8 s.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions