Skip to content

Instantly share code, notes, and snippets.

@MrAmbiG
Last active March 25, 2021 19:17
Show Gist options
  • Save MrAmbiG/6e6f9ed906f4c02bd2bd0d24533bbf81 to your computer and use it in GitHub Desktop.
Save MrAmbiG/6e6f9ed906f4c02bd2bd0d24533bbf81 to your computer and use it in GitHub Desktop.
rkeNodeReset.sh
#!/bin/bash
sudo ls
docker rm -f $(docker ps -qa)
docker rmi -f $(docker images -q)
docker volume rm $(docker volume ls -q)
cleanupdirs="/var/lib/etcd /etc/kubernetes /etc/cni /opt/cni /var/lib/cni /var/run/calico"
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 sudo umount $mount; done
sudo 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment