Operators summarise a lot of state into one line. For a PostgreSQL cluster on Kubernetes that line is usually something like 'Cluster in healthy state', plus a Ready condition that scripts and dashboards trust. The trouble starts when the summary and the Pods disagree. If one instance is crash-looping and the summary still says healthy, everything that consumes it, from deployment gates to status pages to kubectl wait, is told the wrong thing.
This article is a proposed design for cross-checking that summary against the Pods. Nothing in it has been run by us in a cluster.
When Ready=True and a crash loop coexist
This has been reported against CloudNativePG at least twice by different people. A mid-2025 report described a cluster that kept saying healthy while a replica could not catch up because required WAL files were missing. A recent report, against a 1.30.x release, described a replica cluster whose designated primary crash-looped after a demotion with a timeline mismatch in the PostgreSQL log, while the cluster kept showing Ready=True for the ten minutes or more the reporter watched.
The causes differ, but the class of failure is the same: an unhealthy instance that the aggregate status does not reflect. The earlier report was closed as stale without a fix, and the recent one was still open when this was written. These are user reports, not documented behaviour, so check your own version.
The impact is easy to miss because nothing looks broken at the summary level. In the recent report the second instance was in recovery with no WAL receiver, so the standby side of the topology was not protecting anything while the status said all was well.
Why the Ready condition alone falls short
The documented checks are sensible. The troubleshooting guide starts with kubectl cnpg status and cluster conditions, and shows kubectl wait --for=condition=Ready for scripting [1]. The replica cluster documentation explains that the designated primary in a replica cluster runs the WAL receiver and connects to the source, and that promotion switches the timeline [2]. Those are the right tools for understanding the topology.
The weakness is using the Ready condition as the only gate:
- Pipelines. A step that waits for Ready after a switchover, disaster recovery drill or upgrade passes while a designated primary is failing to start.
- Cluster-level alerting. Alerts built on cluster conditions share the same blind spot.
- Pod-level alerting. CrashLoopBackOff alerts may be filtered by namespace or workload type, or muted during planned maintenance, so a database Pod in a long back-off can sit unnoticed.
The cross-check design
Solution label: Proposed architecture (designed here, not executed). It uses standard Kubernetes objects and the CloudNativePG commands documented in the troubleshooting guide. The principle: verify the operator's summary against independent evidence, and treat disagreement as an incident.
- 01
Instance-level check
For every Pod carrying the CloudNativePG cluster label, read container state, restart count and waiting reason. A Pod in CrashLoopBackOff, or with a climbing restart count, is unhealthy whatever the summary says.
- 02
Comparison
For each cluster, flag the case where the Cluster reports Ready but at least one instance Pod is not ready or is in back-off. The disagreement is the signal: either the summary is late or it does not model that failure.
- 03
Diagnosis
Read the previous container logs of the failing Pod and classify the cause (timeline mismatch, missing WAL, full volume, bad credentials), then attach it to the alert so the on-call person starts from a cause, not a status.
- 04
Automation gate
Any pipeline step that relies only on Ready after a switchover or failover should also require that all instance Pods are ready and not restarting for a defined interval.
Layers one to three are read-only: Pods, Pod logs, Events and Cluster resources. The only write path is a human fixing the topology. A timeline mismatch in a replica cluster usually means the former primary must be rebuilt or re-synchronised, and the documentation notes that a failover without the promotion token requires the former primary to be rebuilt [2].
Where Srenix fits
Srenix is an autonomous AI SRE for Kubernetes that runs inside your cluster. It is in beta with Design Partners, and places are limited. Per Reliora's current product material, it ships a CrashLoopBackOff probe and a CloudNativePG Postgres probe, and it can be triggered by Kubernetes informers or by Prometheus alerts through Alertmanager. The CrashLoopBackOff probe works on Pod state, so it does not depend on the Cluster summary, which is the property this design needs. Findings are written as Kubernetes resources you can list with kubectl get driftreports, and it can report to Slack.
What stays outside Srenix is the repair. Resynchronising or rebuilding a replica cluster after a timeline divergence is a human decision: Srenix diagnoses and proposes, a human approves in Slack. Autonomy is off by default, autonomous fixes require a fully green gate, and below the 0.95 confidence floor it asks a human. It does not change PostgreSQL replication topology on its own, and its five built-in fixers include nothing for this case. Every action lands in a signed, hash-chained audit trail, and it re-runs the original check after a fix.
Implementation walkthrough
Names are illustrative. Steps 1 to 5 are read-only.
Step 1: see the summary and the Pods side by side. The first two commands appear in the troubleshooting guide [1].
kubectl get cluster -A
kubectl cnpg status dr-site-a -n databases
kubectl get pod -n databases -l cnpg.io/cluster=dr-site-a -o wideStep 2: read instance state without the Cluster status. A WAITING value of CrashLoopBackOff, or READY false with a rising RESTARTS count, is the evidence.
kubectl get pods -A -l cnpg.io/cluster -o custom-columns=NS:.metadata.namespace,POD:.metadata.name,READY:.status.containerStatuses[0].ready,RESTARTS:.status.containerStatuses[0].restartCount,WAITING:.status.containerStatuses[0].state.waiting.reasonStep 3: read why it is failing. The previous-logs command is shown in the troubleshooting guide [1]. In the reported case the log contained a timeline mismatch at startup.
kubectl logs --previous dr-site-a-1 -n databases
kubectl describe pod dr-site-a-1 -n databasesStep 4: prove the disagreement. If the wait succeeds while Step 2 shows a crash-looping instance, you have the mismatch.
kubectl get cluster dr-site-a -n databases -o jsonpath='{.status.conditions[*].type}'
kubectl wait --for=condition=Ready cluster/dr-site-a -n databases --timeout=60sStep 5: alerting (pseudocode). Fire when a database-namespace Pod has kube_pod_container_status_waiting_reason{reason='CrashLoopBackOff'} == 1 for five minutes. Do not silence database namespaces for planned maintenance unless a change ticket exists. Metric names come from kube-state-metrics.
Step 6: remediation (changes production, needs a human).
Follow the replica cluster documentation for your topology [2], confirm which cluster should be primary, then rebuild or re-synchronise the diverged instance. Do not delete data volumes until you have confirmed a good copy and a recent backup.
Step 7: verify. Re-run Steps 2 and 4. Confirm the instance is ready, restarts have stopped climbing, and the standby side has an active WAL receiver per kubectl cnpg status.
Tradeoffs and failure modes
- Two sources of truth. Pods and summary will sometimes disagree briefly during normal rollouts, so require persistence before alerting.
- Planned switchovers are noisy. Tie CrashLoopBackOff alerts to change windows rather than silencing the namespace.
- Limited view. The check only sees what Kubernetes sees. A running but misconfigured instance, or a replication problem that does not crash the Pod, passes the Pod-level test, so keep replication lag and WAL receiver checks too.
- It may already be fixed. If your operator version now reflects these states in the Cluster condition, the independent check becomes belt-and-braces, which is still reasonable for a database.
How to validate
Acceptance criteria are targets, not measured results:
- In a test replica topology, a deliberately diverged designated primary is flagged within five minutes of its first crash.
- No alert fires during a controlled switchover that completes cleanly.
- The alert includes the failing Pod, the restart count and the first error line of the previous log.
- The pipeline gate refuses to proceed while an instance is in back-off, even if the Cluster shows Ready.
Test plan: create two CloudNativePG clusters in a throwaway environment as a distributed topology per the replica cluster documentation [2]. Perform a switchover correctly and confirm no false alert. Repeat with a deliberate mistake, such as promoting without the promotion token, and record what the Cluster condition says against what the Pods say on your exact operator version. Measure time to detection and the quality of the log summary.
The taking point
A Ready condition is a summary, not a measurement. For database clusters, treat disagreement between the summary and the Pods as a first-class alert, put an instance-level check in front of any automation that trusts the summary, and keep topology repairs in human hands. If you want that cross-check running inside your own cluster, you can read more at reliora.ai.
Sources
[1] CloudNativePG documentation, Troubleshooting guide (v1.29).
[2] CloudNativePG documentation, Replica clusters (v1.30).



