Kubernetes stuck on removing PV
Quote from moshe on 14/07/2021, 9:41 amProblem
when trying to delete PV the resource is stuck in Terminating state and does not get deleted
Example:
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
pvc-26026e36-c6f0-4414-a34c-7a996747fedb 1Gi RWO Delete Terminating default/pv1 standard 5d10h
Solution
Locate your PV with the following command
kubectl get pv
then edit the resource
kubectl edit pv <PV NAME>
find the following lines in the editor
finalizers:
– kubernetes.io/pv-protection
Delete both of them save and exit the VI editor
Run the following command
kubectl delete pv <PV NAME> –grace-period=0 –force
Problem
when trying to delete PV the resource is stuck in Terminating state and does not get deleted
Example:
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
pvc-26026e36-c6f0-4414-a34c-7a996747fedb 1Gi RWO Delete Terminating default/pv1 standard 5d10h
Solution
Locate your PV with the following command
kubectl get pv
then edit the resource
kubectl edit pv <PV NAME>
find the following lines in the editor
finalizers:
– kubernetes.io/pv-protection
Delete both of them save and exit the VI editor
Run the following command
kubectl delete pv <PV NAME> –grace-period=0 –force
Quote from Moshe Sharon on 30/10/2022, 6:00 amIf you still need to keep the pvc settings and want to remove only the PV
edit the PV settings
kubectl edit pv pvc-9358d04c-497b-46fb-b828-d61385be8c08
and remove all parameters under finalizers
finalizers:
– kubernetes.io/pv-protectionto
finalizers:
save the new PV settings
If you still need to keep the pvc settings and want to remove only the PV
edit the PV settings
kubectl edit pv pvc-9358d04c-497b-46fb-b828-d61385be8c08
and remove all parameters under finalizers
finalizers:
– kubernetes.io/pv-protectionto
finalizers:
save the new PV settings
Quote from moshe on 30/10/2022, 11:02 amPV Stuck on terminating state
For AWS EKS deployments remove both of this lines
finalizers:
– kubernetes.io/pv-protection
– external-attacher/ebs-csi-aws-comto
finalizers:
PV Stuck on terminating state
For AWS EKS deployments remove both of this lines
finalizers:
– kubernetes.io/pv-protection
– external-attacher/ebs-csi-aws-comto
finalizers: