Kubernetes
Uninstallation
Guide
How-To
Cluster Management

How to completely uninstall kubernetes

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

Introduction

There is no single universal "uninstall Kubernetes" command because the correct cleanup depends on how Kubernetes was installed. A kubeadm-based cluster on Linux is removed differently from Minikube, kind, k3s, or a managed cloud cluster.

If your goal is a true reset on a self-managed node, the job usually has three parts: reset cluster state, remove packages and configuration files, and clean up the container runtime or CNI artifacts left behind.

Identify the Installation Type First

Before deleting anything, confirm what you are uninstalling.

Common cases:

  • kubeadm on Linux nodes
  • Minikube on a local workstation
  • kind clusters running in Docker
  • k3s or MicroK8s distributions
  • managed clusters such as EKS, GKE, or AKS

The commands are different. For example, deleting an EKS cluster is a cloud control-plane operation, not a matter of wiping /etc/kubernetes on your laptop.

For a self-managed kubeadm node, this is the usual starting point.

Reset a kubeadm-Based Node

The safest first command is kubeadm reset.

bash
sudo kubeadm reset -f

That removes much of the cluster state from the node, including certificates and static pod manifests that kubeadm created.

After the reset, stop the kubelet and remove Kubernetes packages if you do not plan to reinstall immediately.

bash
sudo systemctl stop kubelet
sudo apt-get purge -y kubeadm kubectl kubelet kubernetes-cni
sudo apt-get autoremove -y

On RPM-based systems, use the equivalent package manager instead.

bash
sudo yum remove -y kubeadm kubectl kubelet kubernetes-cni

Remove Residual Configuration and State

Package removal does not clean everything. Kubernetes leaves state in several directories.

bash
1sudo rm -rf /etc/kubernetes
2sudo rm -rf /var/lib/kubelet
3sudo rm -rf /var/lib/etcd
4sudo rm -rf ~/.kube

You may also want to remove CNI state if you are trying to return the machine to a clean pre-cluster condition.

bash
sudo rm -rf /etc/cni/net.d
sudo rm -rf /var/lib/cni

Be deliberate here. These paths may contain state you would want if you planned to recover the cluster instead of destroying it.

Clean Up Networking and Runtime Artifacts

Kubernetes installs networking rules and depends on a container runtime. After uninstalling the cluster, stale interfaces and iptables rules can remain.

Depending on your setup, you may need to restart the runtime or remove leftover bridges manually.

bash
sudo systemctl restart containerd

If you used Docker-backed local tooling such as kind, the cleanup path is different.

Local Development Variants

For Minikube, use the tool's own cleanup command:

bash
minikube delete --all --purge

For kind, delete the cluster through kind itself:

bash
kind delete cluster --name dev

For k3s, use the packaged uninstall script:

bash
sudo /usr/local/bin/k3s-uninstall.sh

For MicroK8s:

bash
sudo snap remove microk8s --purge

These distributions install extra components and paths that generic kubeadm cleanup commands will not always remove correctly.

Verify That the Node Is Clean

A quick verification pass helps avoid partial uninstalls.

bash
1which kubeadm
2which kubelet
3which kubectl
4systemctl status kubelet

If kubectl is still present, that may simply mean the binary remains installed, not that the cluster still exists. Check both packages and directories.

On a machine meant for reinstallation, it is also useful to verify swap, container runtime configuration, and networking state before starting over.

Common Pitfalls

The biggest mistake is assuming every Kubernetes installation can be removed the same way. It cannot.

Another common issue is skipping kubeadm reset and only deleting packages. That often leaves behind certificates, manifests, and kubelet state that interfere with a later reinstall.

People also forget CNI and networking artifacts. Even when the control plane is gone, stale network configuration can cause confusing behavior on the next cluster bootstrap.

Finally, do not delete data directories blindly on a machine that still matters operationally. rm -rf /var/lib/etcd is correct for destruction, but disastrous if you still needed the cluster state.

Summary

  • Uninstall steps depend on whether you used kubeadm, Minikube, kind, k3s, MicroK8s, or a managed service.
  • For kubeadm nodes, start with kubeadm reset -f.
  • Remove packages and then delete leftover configuration and state directories.
  • Clean up CNI and container runtime artifacts if you need a true reset.
  • Use tool-specific uninstall commands for local Kubernetes distributions.
  • Verify the node state after cleanup before reinstalling or repurposing it.

Related reading
Course
Beginner
27 lessons
10 hours
System Design Fundamentals

Build a strong foundation in designing scalable, reliable distributed systems.

View the course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

All Rights Reserved.