Remove Rancher Node without Delete VM

Art Krisada
1 min readJun 29, 2020

--

I used Rancher but every times I need to removed the Node, I have to recreate new VM. I can not reused my VM.

After I found this Articles, I can reuse my VM again. https://rancher.com/docs/rancher/v2.x/en/cluster-admin/cleaning-cluster-nodes/

So this is my notes on removing Rancher Nodes.

  1. Select the node or cluster you want to remove. Then use the delete button to delete what you want.

2. Go to target machine. Remove Docker Containers.

docker rm -f $(docker ps -qa)
docker rmi -f $(docker images -q)

3. Remove Docker Volume created by Container.

docker volume rm $(docker volume ls -q)

4. Unmount what Rancher Mount for you.

for mount in $(mount | grep tmpfs | grep '/var/lib/kubelet' | awk '{ print $3 }') /var/lib/kubelet /var/lib/rancher; do umount $mount; done

5. Delete folder that Rancher created. such as /etc/kubernetes and so on…

rm -rf /etc/ceph \
/etc/cni \
/etc/kubernetes \
/opt/cni \
/opt/rke \
/run/secrets/kubernetes.io \
/run/calico \
/run/flannel \
/var/lib/calico \
/var/lib/etcd \
/var/lib/cni \
/var/lib/kubelet \
/var/lib/rancher/rke/log \
/var/log/containers \
/var/log/kube-audit \
/var/log/pods \
/var/run/calico

6. Now you can recreate Node in VM that you just clear your Old Rancher Contents.

--

--

Art Krisada
Art Krisada

Written by Art Krisada

Never stop learning, because life never stop teaching.

No responses yet