Last active
January 17, 2019 18:39
-
-
Save laurybueno/4ad06af90c2f2b3c14a5dc34b31ad1cf to your computer and use it in GitHub Desktop.
Clean a kubernetes worker from any configuration before adding it to a new cluster
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker rm -f $(docker ps -qa) | |
docker rmi $(docker images -a -q) | |
docker volume rm -f $(docker volume ls -q) | |
cleanupdirs="/var/lib/etcd /etc/kubernetes /etc/cni /opt/cni /var/lib/cni /var/run/calico /opt/rke" | |
for dir in $cleanupdirs; do | |
echo "Removing $dir" | |
rm -rf $dir | |
done | |
for mount in $(mount | grep tmpfs | grep '/var/lib/kubelet' | awk '{ print $3 }') /var/lib/kubelet /var/lib/rancher; do umount $mount; done | |
rm -rf /etc/ceph \ | |
/etc/cni \ | |
/etc/kubernetes \ | |
/opt/cni \ | |
/opt/rke \ | |
/run/secrets/kubernetes.io \ | |
/run/calico \ | |
/run/flannel \ | |
/var/lib/calico \ | |
/var/lib/etcd \ | |
/var/lib/cni \ | |
/var/lib/kubelet \ | |
/var/lib/rancher/rke/log \ | |
/var/log/containers \ | |
/var/log/pods \ | |
/var/run/calico | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment