删除storageclass和pvc(卸载卷、删除卷声明等,根据实际情况修改)
kubectl delete -f rook/deploy/examples/csi/cephfs/pod.yaml
kubectl delete -f rook/deploy/examples/csi/cephfs/pvc.yaml
kubectl delete -n rook-ceph cephblockpool replicapool
kubectl delete -f rook/deploy/examples/filesystem.yaml
kubectl delete -f rook/deploy/examples/csi/cephfs/storageclass.yaml
kubectl delete storageclass rook-cephfs
删除Cephcluster CRD
kubectl -n rook-ceph patch cephcluster rook-ceph --type merge -p '{"spec":{"cleanupPolicy":{"confirmation":"yes-really-destroy-data"}}}'
kubectl -n rook-ceph delete cephcluster rook-ceph
#删除卡主查看日志
kubectl describe cephcluster rook-ceph -n rook-ceph
#强制删除方法
参考文章最后:故障排除
#检查
kubectl -n rook-ceph get cephcluster
清理宿主机数据目录
rm -rf /var/lib/rook
卸载Rook Operator
kubectl delete -f operator.yaml
kubectl delete -f common.yaml
kubectl delete -f psp.yaml
kubectl delete -f crds.yaml
清理磁盘(如果磁盘仍然报告锁定,重新启动节点通常有助于清除磁盘上与 LVM 相关的保留)
yum install gdisk -y
DISK="/dev/sdX"
# Zap the disk to a fresh, usable state (zap-all is important, b/c MBR has to be clean)
sgdisk --zap-all $DISK
# Wipe a large portion of the beginning of the disk to remove more LVM metadata that may be present
dd if=/dev/zero of="$DISK" bs=1M count=100 oflag=direct,dsync
# SSDs may be better cleaned with blkdiscard instead of dd
blkdiscard $DISK
# Inform the OS of partition table changes
partprobe $DISK
故障排除
创建 Cluster CRD 时,Rook 运算符会自动添加终结器。终结器将允许操作员确保在删除集群 CRD 之前,所有块和文件挂载都将被清理。如果没有适当的清理,消耗存储的 Pod 将无限期挂起,直到系统重新启动。使用以下命令手动删除finalizer
for CRD in $(kubectl get crd -n rook-ceph | awk '/ceph.rook.io/ {print $1}'); do
kubectl get -n rook-ceph "$CRD" -o name | \
xargs -I {} kubectl patch -n rook-ceph {} --type merge -p '{"metadata":{"finalizers": []}}'
done
如果命名空间仍处于 Termination 状态,您可以检查哪些资源正在阻止删除,并删除终结器并删除这些资源
kubectl api-resources --verbs=list --namespaced -o name \
| xargs -n 1 kubectl get --show-kind --ignore-not-found -n rook-ceph
删除关键资源finalizer
Rook 为 Ceph 集群关键的资源添加了终结器ceph.rook.io/disaster-protection,这样资源就不会被意外删除。
操作员负责在删除 CephCluster 时删除终结器。如果由于某种原因操作符无法删除终结器(即操作符不再运行),您可以使用以下命令手动删除终结器:
kubectl -n rook-ceph patch configmap rook-ceph-mon-endpoints --type merge -p '{"metadata":{"finalizers": []}}'
kubectl -n rook-ceph patch secrets rook-ceph-mon --type merge -p '{"metadata":{"finalizers": []}}'
标签:ceph,rook,删除,Kubernetes,kubectl,--,Ceph,Rook,delete
From: https://blog.51cto.com/u_14458428/9016115