The stateful set es-data was failing on our test environment and I was asked to delete corresponding PV.
So I deleted the following for es-data: 1) PVC 2) PV They showed as terminating and was left for the weekend. Upon arriving this morning they still showed as terminating so deleted both PVC and PV forcefully. No joy. To fix the whole thing I had to delete the stateful set.
Is this correct if you wanted to delete the PV?
kubectl delete pv [pv-name]
ksu you have to check about the policy of PV it should not be Reclaim Policy.
You can delete the PV using following two commands:
kubectl delete pv <pv_name> --grace-period=0 --force
And then deleting the finalizer using:
kubectl patch pv <pv_name> -p '{"metadata": {"finalizers": null}}'
At the beginning be sure that your Reclaim Policy
is set up to Delete
. After PVC is deleted, PV should be deleted.
https://kubernetes.io/docs/concepts/storage/persistent-volumes/#reclaiming
If it doesn't help, please check this open Kubernetes PV issue: https://github.com/kubernetes/kubernetes/issues/69697
and try to delete the PV finalizers.