Kubernetes Raspberry pi(no Microk8s, k3s)

  1. cgroups
  2. namespaces
  3. runc(this is the actual container implemented using gRPC and protocol buffers)
  4. Docker/CRI(to control runc)
  5. Having structural knowledge of kubernetes is always good.
  1. 2 raspberry pi 4B (4gb)
  • 2 microSD cards(anything greater than 8 gb is good). But why bother when you can get the 32gb at nearly the same price.
  • Two chargers 5V~3A(usb C type). Don’t want to include the messy cables — use PoE.
sudo apt update && sudo apt upgrade
sudo apt update && sudo apt install -y kubelet kubeadm kubectl
echo ‘overlay
br_netfilter’ | sudo tee -a /etc/modules-load.d/containerd.conf
sudo modprobe overlay
sudo modprobe br_netfilter
echo ‘net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
net.bridge.bridge-nf-call-ip6tables = 1’ | sudo tee -a /etc/sysctl.d/99-kubernetes-cri.conf
sudo sysctl — system
# Install containerd
## Set up the repository
### Install packages to allow apt to use a repository over HTTPS
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
### Add Docker’s official GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
### Add Docker apt repository.
sudo add-apt-repository \
"deb https://download.docker.com/linux/ubuntu \
focal \
stable"## Install containerd
sudo apt-get update
sudo apt-get install containerd.io
# Configure containerd
sudo containerd config default | sudo tee /etc/containerd/config.toml
# Restart containerd
sudo systemctl restart containerd
sudo nano /etc/crictl.yaml
runtime-endpoint: unix:///run/containerd/containerd.sock
sudo nano /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
Environment=”KUBELET_EXTRA_ARGS= — cgroup-driver=systemd — container-runtime=remote — runtime-request-timeout=15m — container-runtime-endpoint=unix:///run/containerd/containerd.sock”
sudo systemctl daemon-reload
sudo systemctl restart kubelet.service
kubectl apply -f “https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d ‘\n’)
sudo kubeadm config images pull
sudo kubeadm init — cri-socket /run/containerd/containerd.sock
sudo kubeadm join 192.168.184.186:6443 — token o92btx.6lkh97nb3m7f7 — discovery-token-ca-cert-hash sha256:1dee61cf705803f6284573a987e82654e639b3948b6cab7ffdb793b762
  1. http://levelup.gitconnected.com/step-by-step-slow-guide-kubernetes-cluster-on-raspberry-pi-4b-part-1-6e4179c89cbc
  2. https://www.weave.works/docs/net/latest/install/using-weave/
  3. https://containerd.io/docs/getting-started/
  4. https://opensource.com/article/20/6/kubernetes-raspberry-pi

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store