kubeadm canot join cluster

12/14/2019

I provisionned 2 raspberry pi with :

curl https://get.docker.com| sh
sudo usermod -aG docker pi

sudo su -

apt-get update && apt-get install -y apt-transport-https curl
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -

cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-xenial main
EOF

apt-get update
apt-get install -y kubelet kubeadm kubectl
apt-mark hold kubelet kubeadm kubectl


swapoff -a

Then started on the master :

kubeadm init --apiserver-advertise-address="192.168.0.151"

This gives me the output :

Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

mkdir -p $HOME/.kube sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a pod network to the cluster. Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at: https://kubernetes.io/docs/concepts/cluster-administration/addons/

Then you can join any number of worker nodes by running the following on each as root:

kubeadm join 192.168.0.151:6443 --token szrg5m.q92udr6ury4dve2g \ --discovery-token-ca-cert-hash sha256:b12642ff585b6d068ddf283974cac23946a30552f8f3d3b5db342a23522a08d5 root@raspberrypi:~#

Then on the worker i run :

kubeadm join 192.168.0.151:6443 --token szrg5m.q92udr6ury4dve2g --discovery-token-ca-cert-hash sha256:b12642ff585b6d068ddf283974cac23946a30552f8f3d3b5db342a23522a08d5

And the output :

This node has joined the cluster: * Certificate signing request was sent to apiserver and a response was received. * The Kubelet was informed of the new secure connection details.

Run 'kubectl get nodes' on the control-plane to see this node join the cluster.

Then back on the master :

sudo cp /etc/kubernetes/admin.conf $HOME/
sudo chown $(id -u):$(id -g) $HOME/admin.conf
export KUBECONFIG=$HOME/admin.conf

Mys issue is that now node1 does not appear when u run :

kubectl get nodes

Here the output :

root@raspberrypi:~# kubectl get nodes

NAME STATUS ROLES AGE VERSION

raspberrypi NotReady master 11m v1.17.0

Cannot see what i missed ?

Can someone help ?

Thanks

-- user1361815
kubeadm
kubernetes

1 Answer

12/14/2019

Ok found the problem My problem was that both master and worker had the same hostname :

raspberrypi

So when worker joined the cluster i had this message :

This node has joined the cluster: * Certificate signing request was sent to apiserver and a response was received. * The Kubelet was informed of the new secure connection details.

Run 'kubectl get nodes' on the control-plane to see this node join the cluster.

And it was correct

But when i run :

kubectl get nodes

I suppose that kubeadmin manages the cluster members like a Set in Java ;-) No duplicates

Now i changed worker name and i can see both

-- user1361815
Source: StackOverflow