Last active
September 22, 2024 06:28
-
-
Save theprantadutta/7ab0dfd458e17be02d1ca5693a332bce to your computer and use it in GitHub Desktop.
Deletes kubernetes from ubuntu, run this ``` bash <(curl -s https://gist.githubusercontent.com/theprantadutta/7ab0dfd458e17be02d1ca5693a332bce/raw/delete-kubernetes.sh) ```
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
#!/bin/sh | |
# Kube Admin Reset | |
kubeadm reset -f | |
# Remove all packages related to Kubernetes | |
apt remove -y kubeadm kubectl kubelet kubernetes-cni | |
apt purge -y kube* | |
# Remove docker containers/ images ( optional if using docker) | |
docker image prune -a | |
systemctl restart docker | |
apt purge -y docker-engine docker docker.io docker-ce docker-ce-cli containerd containerd.io runc --allow-change-held-packages | |
# Remove parts | |
apt autoremove -y | |
# Remove all folder associated to kubernetes, etcd, and docker | |
rm -rf ~/.kube | |
rm -rf /etc/cni /etc/kubernetes /var/lib/dockershim /var/lib/etcd /var/lib/kubelet /var/lib/etcd2/ /var/run/kubernetes ~/.kube/* | |
rm -rf /var/lib/docker /etc/docker /var/run/docker.sock | |
rm -f /etc/apparmor.d/docker /etc/systemd/system/etcd* | |
# Delete docker group (optional) | |
groupdel docker | |
# Clear the iptables | |
iptables -F && iptables -X | |
iptables -t nat -F && iptables -t nat -X | |
iptables -t raw -F && iptables -t raw -X | |
iptables -t mangle -F && iptables -t mangle -X |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment