清理rancher环境的脚本

 cat /home/clean_rancher.sh 
df -h|grep kubelet |awk -F % '{print $2}'|xargs umount 
rm /var/lib/kubelet/* -rf
rm /etc/kubernetes/* -rf
rm /var/lib/rancher/* -rf
rm /var/lib/etcd/* -rf
rm /var/lib/cni/* -rf
iptables -F && iptables -t nat -F
ip link del flannel.1
ip link del tunl0
docker ps -a|awk '{print $1}'|xargs docker rm -f
docker volume ls|awk '{print $2}'|xargs docker volume rm

 

 

清理docker

docker rm -f $(docker ps -qa) && rm -rf /var/lib/etcd /var/lib/cni /var/run/calico /etc/kubernetes/ssl /etc/kubernetes/.tmp/ /opt/cni

你可能感兴趣的:(清理rancher环境的脚本)