How to remove all Kubernetes components from nodes
Article Number: 000020162
Environment
RKE1
RKE2
K3s
Situation
At times a node may need to be cleaned of Kubernetes components for troubleshooting purposes or to reuse the node in another cluster. This article covers the process to remove all Kubernetes components from RKE1, RKE2 or K3s nodes
Please note, these steps will delete all containers, volumes, CNI network interfaces, and directories that relate to Rancher and Kubernetes. They can also flush all iptables rules and delete container images. It is important to perform pre-checks, and backup the node as needed before proceeding with any steps below.
Prerequisites
- A node previously provisioned in an RKE1, RKE2 or K3s cluster.
- The node should no longer be a member of the Kubernetes cluster.
- root/sudo privileges are required to run the cleanup scripts, which modify system services, directories, and network settings.
- Ensure no critical Kubernetes workloads or data are still present on the node; these will be forcefully deleted in the following steps.
Resolution
RKE2
Refer to the RKE2 clean up documentation for the required steps.
K3s
Refer to the K3s clean up documentation for the required steps.
RKE1
Use the Extended Rancher 2 Cleanup script to clean an RKE1 node, and reboot the host.