Skip to content

[Bug]: Stuck in phase "Waiting for the instances to become active" #8602

Closed

Description

@pschichtel

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

[email protected]

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: Ready

On 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

  1. added
    triage
    on Sep 18, 2025
  2. pschichtel commented on Sep 18, 2025

    @pschichtel
    Author

    Connecting to the primary works fine btw.

  3. dosubot commented on Sep 18, 2025

    @dosubot

    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.

    Leave Feedback Ask Dosu about cloudnative-pg Share Dosu with your team

  4. pschichtel commented on Sep 18, 2025

    @pschichtel
    Author

    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.

  5. pschichtel commented on Sep 18, 2025

    @pschichtel
    Author

    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.

  6. wasd171 commented on Oct 4, 2025

    @wasd171

    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 the Cluster resource stuck in Waiting for the instances to become active

  7. Rylon commented on Oct 14, 2025

    @Rylon

    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 by Instance is still down, will retry in 1 second. I followed this example from dosubot above:

    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 https://github.com/cloudnative-pg/cloudnative-pg/issues/5078.
    

    Inserting a dummy row into the primary and deleting it again seemed to unstick the replica as it immediately logged completed backup recovery, then consistent recovery state reached, followed by database system is ready to accept read-only connections.

  8. pschichtel commented on Oct 14, 2025

    @pschichtel
    Author

    I think I tried that as well, but it didn't have an effect. Maybe it wasn't enough data.

  9. pschichtel commented on Oct 16, 2025

    @pschichtel
    Author

    Now I have two clusters stuck in Status: Applying configuration Decrease of hot standby sensitive parameters after 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.

  10. armru commented on Oct 27, 2025

    @armru
    Member

    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.

    closing

  11. pschichtel commented on Oct 27, 2025

    @pschichtel
    Author

    @armru do you think my explanation is reasonable?

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

Metadata

Metadata

Assignees

Labels

triage

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions