Skip to content

[Bug]: Operator stuck in reconciliation loop #9885

Closed as duplicate
Closed as duplicate

Description

@jurim76

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

No response

Version

1.28 (latest patch)

What version of Kubernetes are you using?

1.32

What is your Kubernetes environment?

Self-managed: kind (evaluation)

How did you install the operator?

Helm

What happened?

After operator upgrade to version 1.28, operator stuck in reconciliation loop.
We have about 100 clusters in stage env, some cluster are fine, some clusters stuck with "Waiting for the instances to become active" status.
Operator flood the logs with similar messages, where "db-name" is random db name . PVCs status is OK and databases are functional.

Cluster resource

Relevant log output

{"level":"info","ts":"2026-02-04T15:47:28.367904672Z","msg":"Updating pvc metadata","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"<db-name>","namespace":"cnpg-db"},"namespace":"cnpg-db","name":"<db-name>","reconcileID":"3b8459c7-2e8c-4e5d-a7c2-61520ec43781","pvc":"<db-pvc>","reconciler":"labels"}

Code of Conduct

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

Activity

  1. added
    triage
    on Feb 4, 2026
  2. dosubot commented on Feb 4, 2026

    @dosubot

    Hi @jurim76! I'm Dosu and I’m helping the cloudnative-pg team.

    This is a known issue in CloudNativePG, especially after upgrades or when certain changes are applied. The operator gets stuck in a reconciliation loop with "Waiting for the instances to become active" and floods logs with "Updating pvc metadata" when it can't bring all pods to a ready state. This is usually caused by one of these scenarios:

    • Simultaneous changes to both storage (PVC size) and resource requests/limits in a single update. This can deadlock the operator, as it waits for PVCs to resize while pods can't restart due to resource changes, or vice versa. The recommended workaround is to always apply storage and resource changes in separate steps, waiting for the cluster to become healthy after each change before proceeding to the next. If the cluster is already stuck, try deleting the affected pod and PVC (not the primary) to force recreation, or make a small data change on the primary to trigger a state update. Reference Reference

    • Missing or incorrect labels/annotations on PVCs (especially WAL PVCs) can also cause the operator to be stuck in reconciliation, even if the database is functional and PVCs are "Bound". Double-check that all PVCs have the expected labels and annotations. Reference

    • The operator's reconciliation logic is strict about PVC metadata. If any required label or annotation is missing or incorrect, it will continuously attempt to patch PVCs, resulting in log flooding if the underlying PVC or pod state cannot progress. Reference

    • The "Waiting for the instances to become active" phase is set when not all expected pods are active/ready. The operator will remain in this phase and continue reconciling until all instances are ready. Reference

    Best practices: never combine PVC and resource changes in one operation, and always check PVC and pod status if you see this loop. If you need more targeted help, sharing the output of kubectl get pods,pvc -n <namespace> and the relevant cluster YAML can help pinpoint the issue.

    To reply, just mention @dosu.


    Share context across your team and agents. Try Dosu.

    Leave Feedback Learn about cloudnative-pg with Dosu Add Dosu to your team

  3. jurim76 commented on Feb 4, 2026

    @jurim76
    Author

    Increasing the primary PVC and deleting the replica didn't help for me in some cases.
    Also "Simultaneous changes to both storage (PVC size) and resource requests/limits in a single update. This can deadlock the operator" sounds strange to me, I guess the operator should handle this scenario without any issues.

  4. dosubot commented on Feb 4, 2026

    @dosubot

    This scenario is a known limitation in CloudNativePG. The operator does not currently have logic to coordinate or block simultaneous changes to PVC size and resource requests/limits, which can lead to a deadlock: the operator waits for PVCs to finish resizing before restarting pods, but the PVC resize itself may require a pod restart to complete. If both changes are applied together, neither can progress, and the cluster gets stuck in the "Waiting for the instances to become active" phase, with repeated PVC metadata updates in the logs. This is confirmed by both user reports and the codebase—there's no sequencing or validation to prevent this situation, and the reconciliation loop will just keep retrying until the deadlock is resolved manually (details, code reference).

    Increasing the primary PVC and deleting a replica may not resolve the issue if the deadlock is already in place or if there are other stuck pods/PVCs. The best practice is to always apply storage and resource changes in separate steps, waiting for the cluster to become healthy after each change. If a cluster is already stuck, deleting the affected pod and PVC (not the primary) can sometimes force recovery, but in some cases, a more manual intervention or even restoring from backup may be needed (example, troubleshooting).

    This is a gap in the current operator logic, and improvements to handle or prevent these deadlocks are still open for future development.

    To reply, just mention @dosu.


    Share context across your team and agents. Try Dosu.

    Leave Feedback Learn about cloudnative-pg with Dosu Add Dosu to your team

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