[root@k8s-node2 k8s_node]# rm -rf /var/lib/kubelet
rm: cannot remove ‘/var/lib/kubelet/pods/0552a913-ea4a-4b91-84a7-87ca6d9f8611/volumes/kubernetes.io~secret/etcd-certs’: Device or resource busy
rm: cannot remove ‘/var/lib/kubelet/pods/0552a913-ea4a-4b91-84a7-87ca6d9f8611/volumes/kubernetes.io~secret/calico-node-token-7jrks’: Device or resource busy
rm: cannot remove ‘/var/lib/kubelet/pods/ea2b55a3-0891-4965-a64d-2f27b7d29bf6/volumes/kubernetes.io~secret/etcd-certs’: Device or resource busy
rm: cannot remove ‘/var/lib/kubelet/pods/ea2b55a3-0891-4965-a64d-2f27b7d29bf6/volumes/kubernetes.io~secret/calico-kube-controllers-token-sgpr9’: Device or resource busy
rm: cannot remove ‘/var/lib/kubelet/pods/cc699261-f1a5-4c8d-913f-9af943bc4117/volumes/kubernetes.io~secret/coredns-token-rnb5t’: Device or resource busy
rm: cannot remove ‘/var/lib/kubelet/pods/4533016b-95bf-4376-a3a0-57d8c2b37fc8/volumes/kubernetes.io~secret/kubernetes-dashboard-token-nzqr8’: Device or resource busy
rm: cannot remove ‘/var/lib/kubelet/pods/2b1e0ff1-23e7-412a-a1f3-a6b6d8c5c991/volumes/kubernetes.io~secret/kubernetes-dashboard-certs’: Device or resource busy
rm: cannot remove ‘/var/lib/kubelet/pods/2b1e0ff1-23e7-412a-a1f3-a6b6d8c5c991/volumes/kubernetes.io~secret/kubernetes-dashboard-token-nzqr8’: Device or resource busy
查看挂载信息
[root@k8s-node2 k8s_node]# df -HT | grep '/var/lib/kubelet/pods'
tmpfs tmpfs 1.5G 0 1.5G 0% /var/lib/kubelet/pods/0552a913-ea4a-4b91-84a7-87ca6d9f8611/volumes/kubernetes.io~secret/etcd-certs
tmpfs tmpfs 1.5G 13k 1.5G 1% /var/lib/kubelet/pods/0552a913-ea4a-4b91-84a7-87ca6d9f8611/volumes/kubernetes.io~secret/calico-node-token-7jrks
tmpfs tmpfs 1.5G 13k 1.5G 1% /var/lib/kubelet/pods/cc699261-f1a5-4c8d-913f-9af943bc4117/volumes/kubernetes.io~secret/coredns-token-rnb5t
tmpfs tmpfs 1.5G 13k 1.5G 1% /var/lib/kubelet/pods/ea2b55a3-0891-4965-a64d-2f27b7d29bf6/volumes/kubernetes.io~secret/etcd-certs
tmpfs tmpfs 1.5G 13k 1.5G 1% /var/lib/kubelet/pods/ea2b55a3-0891-4965-a64d-2f27b7d29bf6/volumes/kubernetes.io~secret/calico-kube-controllers-token-sgpr9
tmpfs tmpfs 1.5G 0 1.5G 0% /var/lib/kubelet/pods/2b1e0ff1-23e7-412a-a1f3-a6b6d8c5c991/volumes/kubernetes.io~secret/kubernetes-dashboard-certs
tmpfs tmpfs 1.5G 13k 1.5G 1% /var/lib/kubelet/pods/2b1e0ff1-23e7-412a-a1f3-a6b6d8c5c991/volumes/kubernetes.io~secret/kubernetes-dashboard-token-nzqr8
tmpfs tmpfs 1.5G 13k 1.5G 1% /var/lib/kubelet/pods/4533016b-95bf-4376-a3a0-57d8c2b37fc8/volumes/kubernetes.io~secret/kubernetes-dashboard-token-nzqr8
umount这些挂在,然后再删除
[root@k8s-node2 k8s_node]# umount $(df -HT | grep '/var/lib/kubelet/pods' | awk '{print $7}')
# 已查不到挂载信息,再次删除目录则不再报错
[root@k8s-node2 k8s_node]# df -HT | grep '/var/lib/kubelet/pods'