Bare-Metal K8s Cluster with Raspberry Pi – Part 2
This is a continuation from the post series Bare-metal K8s cluster with Raspberry Pi
As we have 1 master node and 3 nodes setup we continue to install Kubernetes.
Install Kubernetes
We are using version 1.15.3. There shouldn’t be any errors, however during my installation the repos were down and I had to retry in a few times.
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | \
sudo apt-key add - && echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | \
sudo tee /etc/apt/sources.list.d/kubernetes.list && sudo apt-get update -q
sudo apt-get install -qy kubelet=1.15.3-00 kubectl=1.15.3-00 kubeadm=1.15.3-00
Repeat steps for all of the Raspberry Pis.
Kubernetes Master Node Configuration
Note: You only need to do this for the master node (in this deployment I recommend only 1 master node). Each Raspberry Pi is a node.
Initiate Master Node
sudo kubeadm init
Enable Connections to Port 8080
Without this Kubernetes services won’t work
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
Add Container Network Interface (CNI)
I’ve chosen to use Weaver, however you can get others working such as Flannel (I’ve verified this works with this cluster)
Get Join Command
This will be used in the next section to join the worker nodes to the cluster. It will return something like:
kubeadm join 192.168.0.101:6443 --token X.Y --discovery-token-ca-cert-hash sha256:XYZ
kubeadm token create --print-join-command
Kubernetes Worker Node Configuration
Note: You only need to do this for the worker nodes (in this deployment I recommend 3 worker node).
Join Cluster
Use the join command provided at the end of the previous sectionsudo kubeadm join 192.168.0.101:6443 --token X.Y --discovery-token-ca-cert-hash sha256:XYZ
Verify Node Added Successfully (SSH on Master Node)
Should have status ready after ~30 secondskubectl get componentstatuses
Another option of running bare-metal K8s cluster in the Raspberry Pi I tried and tested was with Micro K8s will posted in the Part 3 of this series.
Leave a Reply