How to join worker node in existing cluster?

6/7/2019

I was facing some issues while joining worker node in existing cluster. Please find below the details of my scenario.
I've Created a HA clusters with 4 master and 3 worker.
I removed 1 master node.
Removed node was not a part of cluster now and reset was successful. Now joining the removed node as worker node in existing cluster.

I'm firing below command

kubeadm join --token giify2.4i6n2jmc7v50c8st 192.168.230.207:6443 --discovery-token-ca-cert-hash sha256:dd431e6e19db45672add3ab0f0b711da29f1894231dbeb10d823ad833b2f6e1b

In above command - 192.168.230.207 is cluster IP

Result of above command

[preflight] Running pre-flight checks
    [WARNING Service-Docker]: docker service is not enabled, please run 'systemctl enable docker.service'
    [WARNING IsDockerSystemdCheck]: detected "cgroupfs" as the Docker cgroup driver. The recommended driver is "systemd". Please follow the guide at https://kubernetes.io/docs/setup/cri/
    [WARNING FileExisting-tc]: tc not found in system path
    [WARNING Service-Kubelet]: kubelet service is not enabled, please run 'systemctl enable kubelet.service'
[preflight] Reading configuration from the cluster...
[preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -oyaml'
error execution phase preflight: unable to fetch the kubeadm-config ConfigMap: failed to get config map: Get https://192.168.230.206:6443/api/v1/namespaces/kube-system/configmaps/kubeadm-config: dial tcp 192.168.230.206:6443: connect: connection refused

Already tried Steps

  1. ted this file(kubectl -n kube-system get cm kubeadm-config -o yaml) using kubeadm patch and removed references of removed node("192.168.230.206")

  2. We are using external etcd so checked member list to confirm removed node is not a part of etcd now. Fired below command etcdctl --endpoints=https://cluster-ip --ca-file=/etc/etcd/pki/ca.pem --cert-file=/etc/etcd/pki/client.pem --key-file=/etc/etcd/pki/client-key.pem member list

Can someone please help me resolve this issue as I'm not able to join this node?

-- Ankit Sanadhya
kubeadm
kubelet
kubernetes

3 Answers

6/11/2019

In addition to @P Ekambaram answer, I assume that you probably have completely dispose of all redundant data from previous kubeadm join setup.

  1. Remove cluster entries via kubeadm command on worker node: kubeadm reset;

  2. Wipe all redundant data residing on worker node: rm -rf /etc/kubernetes; rm -rf ~/.kube;

  3. Try to re-join worker node.

-- mk_sta
Source: StackOverflow

6/7/2019

fix these problems and run join command

  1. docker service is not enabled, please run 'systemctl enable docker.service'

  2. detected "cgroupfs" as the Docker cgroup driver. The recommended driver is "systemd".

  3. kubelet service is not enabled, please run 'systemctl enable kubelet.service

-- P Ekambaram
Source: StackOverflow

10/16/2019

Use these instructions one after another to completely remove all old installation on worker node.....

kubeadm reset

systemctl stop kubelet

systemctl stop docker

rm -rf /var/lib/cni/

rm -rf /var/lib/kubelet/*

rm -rf /etc/cni/

ifconfig cni0 down

ifconfig flannel.1 down

ifconfig docker0 down

ip link delete cni0

ip link delete flannel.1

systemctl start docker.service

yum remove kubeadm kubectl kubelet kubernetes-cni kube*

yum autoremove

rm -rf ~/.kube

then reinstall using

yum install -y kubelet kubeadm kubectl

reboot

systemctl start docker && systemctl enable docker
systemctl start kubelet && systemctl enable kubelet

then use kubeadm join command

-- Madhu
Source: StackOverflow