K8S卸载

有时候需要卸载已安装在本机的K8S服务和服务

清理运行到k8s群集中的pod
kubectl delete node --all
脚本停止所有k8s服务
for service in kube-apiserver kube-controller-manager kubectl kubelet kube-proxy kube-scheduler; 
do
systemctl stop $service
done
kubeadm reset -f

rm -rf ~/.kube/

rm -rf /etc/kubernetes/

rm -rf /etc/systemd/system/kubelet.service.d

rm -rf /etc/systemd/system/kubelet.service

rm -rf /usr/bin/kube*

rm -rf /etc/cni

rm -rf /opt/cni

rm -rf /var/lib/etcd

rm -rf /var/etcd

yum clean all

yum remove kube* #卸载k8s相关程序
更新镜像
yum clean all
yum -y update
yum makecache