Feb 22, 2022

Single Node Kubernetes on Raspberry Pi 4

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.

apiVersion: v1
kind: Pod
metadata:
  name: python36-arm-demo
  labels:
    purpose: container-args
spec:
  containers:
  - name: python36-demo-container-args
    image: arm64v8/python:3.6 
    command: ["/usr/local/bin/python3"]
    args: ["--version"]
  restartPolicy: OnFailure
  • kubectl apply -f python_pod.yaml
  • kubectl get pods
  • kubectl logs python36-arm-demo
  • kubectl delete -f python_pod.yaml

About the Author

Object Partners profile.
Leave a Reply

Your email address will not be published.

Related Blog Posts
Kafka Schema Evolution With Java Spring Boot and Protobuf
In this blog I will be demonstrating Kafka schema evolution with Java, Spring Boot and Protobuf.  This app is for tutorial purposes, so there will be instances where a refactor could happen. I tried to […]
Redis Bitmaps: Storing state in small places
Redis is a popular open source in-memory data store that supports all kinds of abstract data structures. In this post and in an accompanying example Java project, I am going to explore two great use […]
Let’s build a WordPress & Kernel updated AMI with Packer
First, let’s start with What is an AMI? An Amazon Machine Image (AMI) is a master image for the creation of virtual servers in an AWS environment. The machine images are like templates that are configured with […]
Retrofit2: Get the body from an error response
Retrofit2 is a nice library for making HTTP rest requests. It includes a static utility (CallUtils) for getting the result from your request, but if the api you’re calling doesn’t return a 2xx request it […]