openebs / lvm-localpv

Dynamically provision Stateful Persistent Node-Local Volumes & Filesystems for Kubernetes that is integrated with a backend LVM2 data storage stack.
Apache License 2.0
251 stars 96 forks source link

delete pvc and pv success,but lv is not automatically deleted #197

Closed ptthon closed 4 months ago

ptthon commented 2 years ago

What steps did you take and what happened:

  1. Create a pvc
  2. Delete the pvc
  3. Delete the pv (association of PVC)

What did you expect to happen:

  1. pvc and pv is delete successfully
  2. lv is delete,but I can find the lv on the machine still --- Logical volume --- LV Path /dev/lvmvg/pvc-530f82a7-c8bf-4c8f-83e6-6adf5e75ac12 LV Name pvc-530f82a7-c8bf-4c8f-83e6-6adf5e75ac12 VG Name lvmvg LV UUID GA0GAT-5mWw-jtEP-XRLk-A6Mf-TW1j-jA6NHY LV Write Access read/write LV Creation host, time mgt3, 2022-06-17 15:43:04 +0800 LV Status available

    open 0

    LV Size 15.00 GiB Current LE 3840 Segments 1 Allocation inherit Read ahead sectors auto

    • currently set to 256 Block device 253:16

Environment:

npu21 commented 2 years ago

Ran into this issue days ago too

artarik commented 1 year ago

Did you delete LVMVolume ?

bxy4543 commented 6 months ago

You need to check whether your storageclass.reclaimPolicy is Delete.

dsharma-dc commented 4 months ago

As indicated above, it's related to reclaimPolicy in storage class, which if set to Retain will not delete the underlying volume. Also I notice that in step3 it's mentioned as delete PV. This shouldn't be required. In case of a Retain policy , the PV status will simply change to Released.

I'll go ahead closing this issue now. Please feel free to reopen with details/logs required to help e.g. provisioner logs.

dsharma-dc commented 4 months ago

It would also be good to understand deletions were indeed done in the same order as mentioned in issue description, or there could have a race in running deletion or order swapped. It's possible that the below k8s issue could have possibly caused this : https://github.com/kubernetes/enhancements/blob/master/keps/sig-storage/2644-honor-pv-reclaim-policy/README.md

If you still encounter it, please let us know.