Forum Navigation
You need to log in to create posts and topics.

Kubernetes stuck on removing PV

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