How to Uninstall Kubernetes Completely

DigitalOcean Referral Badge
Start your VPS now with FREE $100 credit.

Kubernetes is an open-source container orchestration platform for automation purposes used by software developers. It is commonly used with Docker to automate Docker deployments.

When it is installed, it opens a few ports for remote debugging and management, as well as some files in /etc/ and /var/lib/.

Later on, when you need to uninstall Kubernetes, those files and ports will become an Achilles’ Hill. Though the intention of Kubernetes developers to open some ports and install a few files are good, the result is not so much.

Kubernetes compared to other deployment methods.
Kubernetes compared to other deployment methods. (Image:

Research suggested that a lot of servers are vulnerable and a few ports away from being hacked. Therefore, a complete uninstallation of every app/program should remove the files it uses, close the ports it opened and undo any changes made to your computer.

Guide on Removing Kubernetes

Actually, removing Kubernetes from your computer entirely is not something impossible, even if it is currently used in conjunction with Docker. Simply use these following commands in succession for Debian-based distribution users:

kubeadm reset
sudo apt-get purge kubeadm kubectl kubelet kubernetes-cni kube*
sudo apt-get autoremove
sudo rm -rf ~/.kube

If you are using CentOS, Red Hat Enterprise, or any distribution using Yum/DNF package management system, use the following command:

kubeadm reset
sudo yum remove kubeadm kubectl kubelet kubernetes-cni kube*
sudo yum autoremove
sudo rm -rf ~/.kube

So, What is Happening Here?

Basically, you need to reset Kubernetes to its factory settings prior to removal so as to not leave any trace on your computer.

READ:  How To Update Apache 2.4 Web Server on VestaCP Ubuntu 14.04 - 18.04 LTS Server

After Kubernetes is removed by the package management system, you need to run extra commands to remove dependencies and save disk space (optional) and remove some residual files that were left in your system.

Now, Kubernetes is finally removed from your computer. If you remove Kubernetes because it behaving strangely, you can now reinstall Kubernetes to see whether your problem has been resolved.

Leave a Comment