Saturday, 3 July 2021

Cannot delete pv

 Hang when trying to delete PV:


[root@okd4-services ~]# oc get pv

NAME          CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS        CLAIM                                             STORAGECLASS   REASON   AGE

registry-pv   100Gi      RWX            Retain           Terminating   openshift-image-registry/image-registry-storage                           151d

[root@okd4-services ~]# kubectl delete pv registry-pv --grace-period=0 --force

warning: Immediate deletion does not wait for confirmation that the running resource has been terminated. The resource may continue to run on the cluster indefinitely.

persistentvolume "registry-pv" force deleted





^C




Solution:

[root@okd4-services ~]# kubectl describe pv registry-pv
Name:            registry-pv
Labels:          <none>
Annotations:     pv.kubernetes.io/bound-by-controller: yes
Finalizers:      [kubernetes.io/pv-protection]
StorageClass:
Status:          Terminating (lasts 13h)
Claim:           openshift-image-registry/image-registry-storage
Reclaim Policy:  Retain
Access Modes:    RWX
VolumeMode:      Filesystem
Capacity:        100Gi
Node Affinity:   <none>
Message:
Source:
    Type:      NFS (an NFS mount that lasts the lifetime of a pod)
    Server:    192.168.1.210
    Path:      /var/nfsshare/registry
    ReadOnly:  false
Events:        <none>

[root@okd4-services ~]# kubectl edit pv registry-pv
persistentvolume/registry-pv edited


i.e. https://stackoverflow.com/questions/55672498/kubernetes-clustsr-stuck-on-removing-pv-pvc/55672788

kubectl edit pv (pv name)

FIND the following

finalizers: - kubernetes.io/pv-protection

AND delete it. Then exit and: kubectl delete pv (pv name) --grace-period=0 --force


No comments:

Post a Comment

PVC in terminating state

Referencee:https://veducate.co.uk/kubernetes-pvc-terminating/  I still had errors performing deployment, till I released that although I pre...