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
Natively Compiled Java on Google App Engine
Google App Engine is a platform-as-a-service product that is marketed as a way to get your applications into the cloud without necessarily knowing all of the infrastructure bits and pieces to do so. Google App […]
Building Better Data Visualization Experiences: Part 2 of 2
If you don't have a Ph.D. in data science, the raw data might be difficult to comprehend. This is where data visualization comes in.
Unleashing Feature Flags onto Kafka Consumers
Feature flags are a tool to strategically enable or disable functionality at runtime. They are often used to drive different user experiences but can also be useful in real-time data systems. In this post, we’ll […]
A security model for developers
Software security is more important than ever, but developing secure applications is more confusing than ever. TLS, mTLS, RBAC, SAML, OAUTH, OWASP, GDPR, SASL, RSA, JWT, cookie, attack vector, DDoS, firewall, VPN, security groups, exploit, […]