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.29 (latest patch)
What version of Kubernetes are you using?
1.36
What is your Kubernetes environment?
Other
How did you install the operator?
YAML manifest
What happened?
What happened
The alpha.cnpg.io/unrecoverable annotation is ineffective for pods in Terminating or Pending state. These are the two most common states during node maintenance with local storage (e.g., OpenEBS LVM):
- Unreachable node: pods get a
DeletionTimestamp(Terminating) that the kubelet can't confirm, so they stay Terminating indefinitely. - Drained node with local storage: pods get evicted and recreated, but the new pod can't be scheduled because the PVC is bound to the cordoned node. The pod sits in Pending.
In both cases, applying alpha.cnpg.io/unrecoverable=true has no effect because the reconciliation loop exits before reaching reconcileUnrecoverableInstances:
getManagedInstancesincludes Terminating and Pending pods (no filter)allInstancesAreActive()returns false becauseIsPodActiverejects bothDeletionTimestamp != nilandPodPendingphase- The reconciler returns early with a 1-second requeue, never reaching
reconcilePods→reconcileUnrecoverableInstances
Relationship to #9947 / #9968
PR #9968 solved a related but different problem: pods that are not ready but still active (e.g., postgres not running, startup probe failing). That fix moved reconcileUnrecoverableInstances before the non-ready gate inside reconcilePods. However, the allInstancesAreActive() gate runs before reconcilePods is called, so Terminating and Pending pods are still blocked.
Expected behavior
Annotating a Terminating or Pending pod with alpha.cnpg.io/unrecoverable=true should cause the operator to delete the pod and its PVCs, allowing a new instance to be created on a healthy node. The PVCs will go Terminating but are already ignored by the instance counter due to DeletionTimestamp filtering.
For the Terminating variant, the pvc-protection finalizer holds PVC deletion while the pod object exists, so the implementation would also need to force-remove the pod (with appropriate safety checks if it was a primary).
Possible approaches
- Move
reconcileUnrecoverableInstancesbefore theallInstancesAreActive()gate (similar to what fix: allow unrecoverable annotation to work on non-ready pods #9968 did for the non-ready gate) - Exclude pods annotated with
alpha.cnpg.io/unrecoverable=truefrom theallInstancesAreActive()check
I'm happy to create/contribute myself once we settle on an approach.
Environment
- CNPG 1.28.x, verified against latest
main(946085b0b) - Bare-metal Kubernetes with OpenEBS LVM local storage (~200 clusters)
Related
- [Bug]: Non-ready pods are not cleared via alpha.cnpg.io/unrecoverable=true annotation #9947
- fix: allow unrecoverable annotation to work on non-ready pods #9968
- My comment on #9968
Cluster resource
NARelevant log output
None, not triggered.Code of Conduct
- I agree to follow this project's Code of Conduct
Activity
daanvinken commentedon Jun 18, 2026
@mnencia @gbartolini any input from you guys here? We were directed by EDB to work through this via the CNPG project itself. I'm happy to contribute here, after an approach has been decided on.
fix: honor unrecoverable annotation on pending and terminating instan…
fix: honor unrecoverable annotation on pending and terminating instan…
fix: honor unrecoverable annotation on pending and terminating instan…
fix: honor unrecoverable annotation on pending and terminating instan…