You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Operator initiates failover without waiting for kubelet to confirm pod is not ready #10423
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
I have read the troubleshooting guide and I think this is a new bug.
Contact Details
No response
Version
trunk (main)
What version of Kubernetes are you using?
No response
What is your Kubernetes environment?
Cloud: Azure AKS
How did you install the operator?
No response
What happened?
The operator decides to initiate failover based solely on its own HTTP health check to the pod IP (30s timeout in rawInstanceStatusRequest). It does not check whether the kubelet has also detected the failure by marking the pod as NotReady.
This can cause premature failovers in environments where pods can be temporarily frozen without crashing (e.g. Azure VM live migration). During a VM migration, the node is paused for a few seconds (typically 8-30s). If a reconciliation cycle happens to run during the freeze, the operator's HTTP request times out and it initiates failover, even though the kubelet is also frozen and still considers the pod Ready. When the VM migration completes, the old primary comes back with PostgreSQL still running as primary.
The operator already collects IsPodReady from the kubelet's ContainersReady condition in the PostgresqlStatus struct (pkg/postgres/status.go:103), but does not use it in the failover decision path.
Proposed fix
In reconcileTargetPrimaryFromPods (replicas.go), before initiating failover, check that the current primary's pod has been marked NotReady by the kubelet. If the operator's HTTP check fails but IsPodReady is still true, the operator should wait rather than immediately triggering failover.
This naturally provides ~30s of protection (readiness probe period=10s, default failure threshold=3), which covers most VM live migration windows.
Activity
Operator initiates failover without waiting for kubelet to confirm p…
github-actions commentedon Jun 8, 2026
This issue is stale because it has been open for 60 days with no activity.
github-actions commentedon Sep 25, 2026
This issue is stale because it has been open for 60 days with no activity.
github-actions commentedon Oct 9, 2026
This issue was closed because it has been inactive for 14 days since being marked as stale.