Cleanup Distributed Storage
If you need to delete a rook-ceph cluster and redeploy a new one, you should follow this document to sequentially clean the distributed storage service related resources.
TOC
Precautions
Before cleaning up rook-ceph, ensure that all PVC and PV resources using Ceph storage have been deleted.
Procedure
Deleting VolumeSnapshotClasses
-
Delete the VolumeSnapshotClasses.
-
Verify that the VolumeSnapshotClasses have been cleaned up.
When there is no output from these commands, it indicates that the cleanup is complete.
Deleting StorageClasses
-
Go to Platform Management.
-
In the left navigation bar, click Storage Management > Storage Classes.
-
Click ⋮ > Delete, and delete all StorageClasses that use Ceph storage solutions.
Deleting Storage Pools
This step should be performed after the previous step has been completed.
-
Go to Platform Management.
-
In the left navigation bar, click Storage Management > Distributed Storage.
-
In the Storage Pool Area, click ⋮ > Delete, and delete all storage pools one by one. When the storage pool area shows No Storage Pools, it indicates successful deletion of the storage pools.
-
(Optional) If the cluster mode is Extended, you also need to execute the following command on the Master node of the cluster to delete the created built-in storage pools.
Response:
Deleting ceph-cluster
This step should be performed after the previous step has been completed.
-
Update the ceph-cluster and enable the cleanup policy.
-
Delete the ceph-cluster.
-
Delete the jobs that perform the cleanup.
-
Verify that the ceph-cluster cleanup is complete.
When this command has no output, it indicates that the cleanup is complete.
Deleting rook-operator
This step should be performed after the previous step has been completed.
-
Delete the rook-operator.
-
Verify that the rook-operator cleanup is complete.
When this command has no output, it indicates that the cleanup is complete.
-
Verify that all ConfigMaps have been cleaned up.
When this command has no output, it indicates that cleanup is complete. If there are output results, execute the following command to clean up, replacing
<configmap>with the actual output. -
Verify that all Secrets have been cleaned up.
When this command has no output, it indicates that cleanup is complete. If there are output results, execute the following command to clean up, replacing
<secret>with the actual output. -
Verify that the rook-ceph cleanup is complete.
When this command has no output, it indicates that cleanup is complete.
Execute Cleanup Script
Once the above steps are completed, it indicates that Kubernetes and Ceph related resources have been cleared. Next, you need to clean up any residuals of rook-ceph on the host.
Cleanup Script
The contents of the cleanup script clean-rook.sh are as follows:
Click to view
Precautions
The cleanup script depends on the sgdisk command, so please make sure to have it installed before executing the cleanup script.
- Installation command for Ubuntu:
sudo apt install gdisk - Installation command for RedHat or CentOS:
sudo yum install gdisk
Procedure
-
Execute the cleanup script clean-rook.sh on each machine in the business cluster where distributed storage is deployed.
Example:
sh clean-rook.sh /dev/vdbWhen executed, you will be prompted to confirm whether to really clear the device. If confirmed, enter yes to begin cleaning.
-
Use the
lsblk -fcommand to check the partition information. When theFSTYPEcolumn in the output of this command is empty, it indicates that the cleanup is complete.