If a cluster is block in the "Deleting" state, it is likely due to the presence of unprocessed finalizers. First, check if the PolarDBXCluster has such a finalizer:
kubectl get pxc {PolarDBX name} -o jsonpath='{.metadata.finalizers}'
["polardbx/finalizer"]
Usually, there will be only one finalizer, which is polardbx/finalizer
and should be handled by the polardbx-operator. If it remains unprocessed for a long time, follow these steps:
- Confirm if the operator is still running
- Check the operator logs to determine the cause
If there are other finalizers present, determine if the corresponding component will handle them:
- If yes, investigate the component to identify the cause
- If not, use
kubectl edit
to manually remove the corresponding finalizer
Batch Operation
If there are multiple xstore or cn, you can perform batch operations using the following command (before executing, ensure you understand the command format and use appropriate filtering to select the objects to delete):
for i in $(kubectl get xstore -o jsonpath='{.items[*].metadata.name}'); do echo $i; kubectl get xstore $i -o json | jq '.metadata.finalizers = null' | kubectl apply -f -; done