Menu

Tech Tuesday: Single Node Kubernetes on Raspberry Pi 4

Dan Peterson // February 22, 2022

Technology

In this post, I will go through the steps I used to create a single-node Kubernetes combination master and worker node on a Raspberry Pi 4. The heavy lifting in this post is done via the Rancher K3s (lightweight Kubernetes) binary

Rancher K3s: https://rancher.com/docs/k3s/latest/en/ 

Pre-requisites: 

  • Raspberry Pi 4 Model B Rev 1.4 
  • 8 GB RAM 
  • 64 Bit OS Debian ‘Buster’ 
  • 64 GB (or larger) SD Card 

Installing 64 Bit Debian Buster

Using this tool, create an image of the 64 bit Buster OS 

Once complete, and you have booted and connected to your new Pi image, verify the installation with the following 

  • cat /etc/os-release |grep PRETTY_NAME 
  • uname -a 

You should see the ‘Buster’ and ‘aarch64’ in the respective outputs. 

Installing Rancher K3s

  • curl -sfL https://get.k3s.io | sh -s – –write-kubeconfig-mode 644 
  • sudo chmod 755 /etc/rancher/k3s/k3s.yaml 
  • sudo cp /etc/rancher/k3s/k3s.yaml ~/.kube/config 

Next, verify with: 

  • systemctl status k3s.service 
  • kubectl get pods 
  • k3s kubectl cluster-info 

Sample Python Pod Image for ARM64 Architecture

Copy the following into the file ‘python_pod.yaml’, and run the commands to create the pod, retrieve the logs showing the python version, then destroy the pod.

null
  • kubectl apply -f python_pod.yaml 
  • kubectl get pods 
  • kubectl logs python36-arm-demo 
  • kubectl delete -f python_pod.yaml 

Most Recent Thoughts

How can we help on your next project?

Let's Talk

Like what you see?

Join Us
Top