kubespray 安装的 k8s 在 dev 环境经常要把 kubernetes 删干净重来。清理方式和安装习惯有关系,只记录 kubespray 安装习惯的清理操作。
kubespray + CentOS7
systemctl stop etcd systemctl stop kubelet
清理所有 docker
docker stop `docker ps -a -q` docker rm `docker ps -a -q` docker rmi `docker images -a -q`
停止 docker
systemctl stop docker
查看依赖的文件,逐个清理
cat /etc/systemd/system/etcd.service cat /etc/systemd/system/docker.service cat /etc/systemd/system/kubelet.service
rm -rf /var/lib/etcd rm -f /etc/etcd.env rm -rf /etc/ssl/etcd/ rm -rf /usr/local/bin/etcd* rm -rf /etc/cni rm -rf /etc/kubernetes rm -rf /var/lib/kubelet rm -rf /usr/local/bin/kube* rm -rf /root/.kube df -h | grep /var/lib/kubelet/pods | awk '{print $NF}' | xargs umount
Leave a Reply