Created
February 24, 2026 05:51
-
-
Save bachmanity1/2f1297cd90b65b4a227f741e39954684 to your computer and use it in GitHub Desktop.
Uninstall Kubernetes from node
This file contains hidden or 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/bash | |
| set -e | |
| echo "[1/6] Resetting kubeadm" | |
| kubeadm reset -f || true | |
| echo "[2/6] Stopping services" | |
| systemctl stop kubelet || true | |
| systemctl disable kubelet || true | |
| systemctl stop containerd || true | |
| systemctl disable containerd || true | |
| echo "[3/6] Cleaning up directories" | |
| rm -rf /etc/kubernetes /var/lib/kubelet /var/lib/etcd /etc/cni/net.d /var/lib/cni | |
| rm -f /etc/kubernetes/bootstrap-kubelet.conf | |
| echo "[4/6] Flushing iptables" | |
| iptables -F | |
| iptables -t nat -F | |
| iptables -t mangle -F | |
| ipvsadm --clear 2>/dev/null || true | |
| echo "[5/6] Removing packages" | |
| dnf remove -y kubelet kubeadm kubectl containerd.io || true | |
| echo "[6/6] Removing repo" | |
| rm -f /etc/yum.repos.d/kubernetes.repo | |
| echo "✅ Kubernetes fully removed from this node." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment