Repository navigation
Description
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
- I have read the troubleshooting guide and I think this is a new bug.
Contact Details
Version
1.27 (latest patch)
What version of Kubernetes are you using?
1.33
What is your Kubernetes environment?
Self-managed: k0s
How did you install the operator?
Helm
What happened?
I originally deployed a 3 node cluster with cnpg which was in normal working condition for a while, but mostly unused. Then I recently scaled the cluster down to 1 in preparation for a data migration. This however had the effect that the alerting triggered because no RO-replicas existed. Since it was supposed to be temporary fix I figured I'll just scale it up to 2 replicas for the moment.
Scaling down worked just fine, the 2 replicas disappeared quickly. Scaling up to 2 also seemingly worked fine, as the replica came up, became ready and was eventually listed as a health instance.
However, the cluster resource stayed in Progressing state (in Argo) as in:
conditions:
- lastTransitionTime: '...'
message: Cluster Is Not Ready
reason: ClusterIsNotReady
status: 'False'
type: ReadyOn closer inspection I found a single danglingPVC in the cluster status (a data volume), which I then deleted, but that made not difference.
Nothing else seems out of the ordinary, but phase stays on "Waiting for the instances to become active" with reason "Some instances are not yet active. Please wait.". I've been waiting for >24h now.
I tried kubectl cnpg restart and kubectl cnpg reload, no effect.
I tried restarting the operator and I also checked its logs, nothing of interest.
Cluster resource
# generated by helm
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: central-postgres
spec:
instances: 2
imageCatalogRef:
apiGroup: postgresql.cnpg.io
kind: ClusterImageCatalog
name: postgresql-supported-versions
major: 17
imagePullPolicy: IfNotPresent
postgresUID: 26
postgresGID: 26
storage:
size: 30Gi
walStorage:
size: 2Gi
affinity:
podAntiAffinityType: required
tolerations:
- effect: NoExecute
key: node.kubernetes.io/not-ready
operator: Exists
tolerationSeconds: 30
- effect: NoExecute
key: node.kubernetes.io/unreachable
operator: Exists
tolerationSeconds: 30
topologyKey: kubernetes.io/hostname
primaryUpdateMethod: switchover
primaryUpdateStrategy: unsupervised
logLevel: info
enableSuperuserAccess: true
enablePDB: true
postgresql:
parameters:
max_connections: "600"
pg_stat_statements.track: all
monitoring:
enablePodMonitor: true
disableDefaultQueries: false
bootstrap:
initdb:Relevant log output
I haven't found any.Code of Conduct
- I agree to follow this project's Code of Conduct
Activity
pschichtel commentedon Sep 18, 2025
Connecting to the primary works fine btw.
dosubot commentedon Sep 18, 2025
Connecting to the primary confirms the DB is running, but CloudNativePG's readiness checks are stricter and often require all instances and configs to be in sync. Clusters can get stuck in "Waiting for the instances to become active" for reasons like: pods in terminating/completed state, PVC issues (dangling, resizing deadlocks), or config mismatches—especially after upgrades or scaling events. In 1.27, a new config parameter (
cnpg.synchronous_standby_names_metadata) can cause readiness to block if not all pods have the same config; forcing pod recreation or temporarily removing sync replication settings can help in that case (example).Other common causes: a replica needing a WAL file that's no longer present (especially if no backup is configured), or a pod stuck in a non-running state. Sometimes, clusters only become healthy after making a data change on the primary, especially if the DB is empty or very small (example).
Check for pods stuck in terminating/completed state, PVCs not being recreated, or config mismatches between pods. If you see any, try deleting the affected pod/PVC to force a rebuild. If everything looks fine, try making a small data change on the primary and see if the cluster transitions to ready. For more details and troubleshooting steps, see the official docs.
To reply, just mention @dosu.
Docs are dead. Just use Dosu.
pschichtel commentedon Sep 18, 2025
I tried explicitly promoting to the replica, which seems to have worked as expected, but it also got stuck in the promotion phase. I also tried what duso suggested: Create some data in the database, but that didn't help.
Then I figured I could just delete the now replica (previously primary) pod including its PVC and have it be bootstrapped from scratch, but that didn't happen, presumably because the operator was in that promotion phase.
Finally to see what happens, I then also delete the pod of the primary, while keeping its PVC around. The expectation was, that the pod is created again, but that doesn't currently happen. Now the cluster is dead.
pschichtel commentedon Sep 18, 2025
Hmm, this may have been caused by PVs getting slightly inconsistent due to me renaming the k8s nodes. I had to delete the remaining PVCs now, so I can't test much more. The new cluster now came up exactly as you'd expect.
Feel free to close this issue.
wasd171 commentedon Oct 4, 2025
I have a similar case – when trying to update the cluster (image update) I suddenly got no database pods (not even in
CrashLoopBackOff, they have just disappeared), with theClusterresource stuck inWaiting for the instances to become activeRylon commentedon Oct 14, 2025
We had a similar thing today, the primary pod was working fine, but the replica was stuck in a loop logging
Consistent recovery state has not been yet reached.followed byInstance is still down, will retry in 1 second. I followed this example from dosubot above:Inserting a dummy row into the primary and deleting it again seemed to unstick the replica as it immediately logged
completed backup recovery, thenconsistent recovery state reached, followed bydatabase system is ready to accept read-only connections.pschichtel commentedon Oct 14, 2025
I think I tried that as well, but it didn't have an effect. Maybe it wasn't enough data.
pschichtel commentedon Oct 16, 2025
Now I have two clusters stuck inStatus: Applying configuration Decrease of hot standby sensitive parametersafter changing parameters.The hanging state was caused by me accidentally triggering a resize of the WAL volume with a StorageClass that doesn't support volume expansion. Fortunately this was logged by the operator, but an event on the cluster object itself would be a lot nicer.
armru commentedon Oct 27, 2025
closing
pschichtel commentedon Oct 27, 2025
@armru do you think my explanation is reasonable?