|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * storage/dynamic-provisioning.adoc |
| 4 | +// * microshift_storage/dynamic-provisioning-microshift.adoc |
| 5 | + |
| 6 | +:_mod-docs-content-type: PROCEDURE |
| 7 | +[id="deleting-an-lvm-cluster_{context}"] |
| 8 | += Deleting an LVMCluster |
| 9 | + |
| 10 | +[role="_abstract"] |
| 11 | +When you delete an `LVMCluster` custom resource (CR), the Operator enforces deletion gates to prevent data loss. The gates that apply depend on the reclaim policy that is configured for the storage class. |
| 12 | + |
| 13 | +.Prerequisites |
| 14 | + |
| 15 | +* You have administrative access to the cluster. |
| 16 | +* You have identified the reclaim policy in use: `Delete` or `Retain`. |
| 17 | +
|
| 18 | +.Procedure |
| 19 | + |
| 20 | +. Delete all Persistent Volume Claims (PVCs) that reference LVM `StorageClass` resources. |
| 21 | ++ |
| 22 | +If PVCs that reference LVM StorageClasses still exist, the Operator blocks `LVMCluster` deletion and generates a `DeletionPending` event: |
| 23 | ++ |
| 24 | +[source,terminal] |
| 25 | +---- |
| 26 | +found PVCs provisioned by LVMS, waiting 10s for their deletion |
| 27 | +---- |
| 28 | + |
| 29 | +. Back up any data before deleting PVCs. |
| 30 | + |
| 31 | +.. List the PVCs that use the LVM StorageClass by running the following command: |
| 32 | ++ |
| 33 | +[source,terminal] |
| 34 | +---- |
| 35 | +$ oc get pvc -A -o custom-columns='NAMESPACE:.metadata.namespace,NAME:.metadata.name,SC:.spec.storageClassName' | grep lvms-vg1 |
| 36 | +---- |
| 37 | + |
| 38 | +.. Delete the PVCs by running the following command: |
| 39 | ++ |
| 40 | +[source,terminal] |
| 41 | +---- |
| 42 | +$ oc delete pvc <pvc_name> -n <namespace> |
| 43 | +---- |
| 44 | ++ |
| 45 | +With the `Delete` reclaim policy, deleting the PVCs automatically removes the persistent volumes (PVs) and on-disk logical volumes. After all PVCs are removed, `LVMCluster` deletion completes automatically. No further action is required. |
| 46 | + |
| 47 | +. If you use the `Retain` reclaim policy, delete the retained PVs. |
| 48 | ++ |
| 49 | +After you delete PVCs, if the reclaim policy is `Retain`, the Operator blocks `LVMCluster` deletion and generates a `DeletionPending` event: |
| 50 | ++ |
| 51 | +[source,terminal] |
| 52 | +---- |
| 53 | +found PVs with Retain policy from LVMS, waiting 10s for manual cleanup |
| 54 | +---- |
| 55 | + |
| 56 | +.. List the retained PVs by running the following command: |
| 57 | ++ |
| 58 | +[source,terminal] |
| 59 | +---- |
| 60 | +$ oc get pv -o custom-columns='NAME:.metadata.name,SC:.spec.storageClassName' | grep lvms-vg1 |
| 61 | +---- |
| 62 | + |
| 63 | +.. Delete the PVs by running the following command: |
| 64 | ++ |
| 65 | +[source,terminal] |
| 66 | +---- |
| 67 | +$ oc delete pv <pv_name> |
| 68 | +---- |
| 69 | + |
| 70 | +. If you are using the `Retain` reclaim policy, delete the TopoLVM `LogicalVolume` custom resources. |
| 71 | ++ |
| 72 | +After you delete PV objects from Kubernetes, the underlying logical volumes remain on disk because the `Retain` policy preserved them. The VG Manager detects this and generates a `ManualCleanupRequired` event: |
| 73 | ++ |
| 74 | +[source,terminal] |
| 75 | +---- |
| 76 | +Warning ManualCleanupRequired volume group vg1 has retained logical volumes [pvc-abc123]; manual cleanup required before deletion can proceed |
| 77 | +---- |
| 78 | + |
| 79 | +. Deleting the `LogicalVolume` custom resources triggers on-disk logical volume cleanup. |
| 80 | + |
| 81 | +.. List the `LogicalVolume` custom resources by running the following command: |
| 82 | ++ |
| 83 | +[source,terminal] |
| 84 | +---- |
| 85 | +$ oc get logicalvolumes |
| 86 | +---- |
| 87 | + |
| 88 | +.. Delete the `LogicalVolume` custom resources for your device class by running the following command: |
| 89 | ++ |
| 90 | +[source,terminal] |
| 91 | +---- |
| 92 | +$ oc delete logicalvolume <lv_name> |
| 93 | +---- |
| 94 | + |
| 95 | +.Verification |
| 96 | + |
| 97 | +* Verify that the `LVMCluster` deletion completed by confirming the resource no longer exists by running the following command: |
| 98 | ++ |
| 99 | +[source,terminal] |
| 100 | +---- |
| 101 | +$ oc get lvmcluster -A |
| 102 | +---- |
0 commit comments