0
votes

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

1
Hi, check the log of kubelet on worker node - Suresh Vishnoi
Hi thanks : I'm getting :kubelet.go:2183] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is cni.go:237] Unable to update cni config: no networks found in /etc/cni/net.d Can it be a root cause ? - user1361815
yup, I guess, you do not have any CNI implenetation running. - Suresh Vishnoi
> You should now deploy a pod network to the cluster. Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at: kubernetes.io/docs/concepts/cluster-administration/addons - Suresh Vishnoi
Here is the example, you need to use some flags while creating the cluster and the apply the manifests kubernetes.io/docs/setup/production-environment/tools/kubeadm/… - Suresh Vishnoi

1 Answers

1
votes

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