Walk-through — install Kubernetes to your Raspberry Pi in 15 minutes

Alex Ellis
Mar 1 · 6 min read

Here’s something you can do before work, with your morning coffee, or whilst waiting for dinner to cook of an evening. And there’s never been a better time to install Kubernetes to a Raspberry Pi, with the price-drop on the 2GB model — perfect for containers.

You can buy a single RPi and still have a lot of fun, here I bought 4x 2GB nodes

I’ll show you how to install Kubernetes to your Raspberry Pi in 15 minutes including monitoring and how to deploy containers.

The bill of materials

I’ll keep this quite simple.

  • Raspberry Pi 4, with 2GB or 4GB RAM — the 2GB is the best value, 4GB is best if you don’t plan on doing clustering.
  • SD card — 32GB recommended, larger is up to you, but Kubernetes writes to disk a lot and could kill a card, so I tend to prefer buying more smaller cards.
  • Power supply — you need the official supply, I know it’s expensive, but that’s for a reason. Don’t be cheap because you’ll buy twice.

If you’d like some links, you can find them in my home-lab post: Kubernetes Homelab with Raspberry Pi and k3sup.

Flash the initial OS

There are so many ways to install an Operating System, but I recommend Raspbian and the Lite edition which ships without a UI.

Once you download the image, you can use Etcher.io from our friends at Balena to flash it without even unzipping it. How cool is that?

Before you boot up that RPi, make sure you create a file named ssh in the boot partition. If on a Mac you'll see that gets mounted for you as soon as you eject and re-insert the SD card.

Connect for the first boot

Now connect to the Raspberry Pi over your local network, it will show up as raspberry.local, but if you can’t connect for some reason, then install nmap and run nmap -sP to run a network scan.

  • Change the password with passwd pi.
  • Run raspi-config and change the memory split to 16mb, so that we have all the RAM for Kubernetes, believe me, it needs it.

Get your CLI tools

Now on your laptop you’ll want a few tools. We don’t need to log into the RPi again, we’ll use it as a server, remotely.

curl -ssL https://get.k3sup.dev | sudo sh

k3sup install can be used to install k3s as a server, to begin a new single-node cluster (that’s what we’ll do today). If you have multiple nodes, then the k3sup join command lets you add in additional agents or workers to expand the capacity.

curl -sSL https://dl.get-arkade.dev | sudo sh

arkade installs apps, the easy way, using their upstream helm charts, but hiding away the gory and boring details.

Install Kubernetes with k3sup and k3s

k3s is a lightweight edition of Kubernetes made by Rancher Labs, it’s suitable for production, but also perfect for small devices like our Raspberry Pi. Its memory requirements are around 500MB for a server vs. around 2GB for kubeadm (upstream Kubernetes)

export IP="" # find from ifconfig on RPi
k3sup install --ip $IP --user pi

In a few moments you’ll receive a kubeconfig file into your local directory, with an instruction on how to use it.

Find the node, and check if it’s ready yet

export KUBECONFIG=`pwd`/kubeconfigkubectl get node -o wide

You can add -w to most kubectl commands to “watch” or “stream” the output status, so you can save on typing.

By default k3s comes with the metrics-server, which is used for Pod autoscaling and getting memory/CPU for pods and nodes:

kubectl top node
kubectl top pod --all-namespaces

Now let’s install one or two apps, run arkade install to see what's available, but not that not all projects in the CNCF landscape work on ARM devices

arkade install --helpAvailable Commands:cert-manager            Install cert-manager
chart Install the specified helm chart
cron-connector Install cron-connector for OpenFaaS
crossplane Install Crossplane
docker-registry Install a Docker registry
docker-registry-ingress Install registry ingress with TLS
info Find info about a Kubernetes app
inlets-operator Install inlets-operator
istio Install istio
kafka-connector Install kafka-connector for OpenFaaS
kubernetes-dashboard Install kubernetes-dashboard
linkerd Install linkerd
metrics-server Install metrics-server
minio Install minio
mongodb Install mongodb
nginx-ingress Install nginx-ingress
openfaas Install openfaas
openfaas-ingress Install openfaas ingress with TLS
postgresql Install postgresql

Let’s try the Kubernetes dashboard?

arkade install kubernetes-dashboard

The installation script prints out how to use the app, and arkade info can show us the same information later too.

#To forward the dashboard to your local machinekubectl proxy#To get your Token for logging inkubectl -n kubernetes-dashboard describe secret $(kubectl -n kubernetes-dashboard get secret | grep admin-user-token | awk '{print $1}')# Once Proxying you can navigate to the belowhttp://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/#/login

Paste in your token

Now enjoy the dashboard:

Let’s install another popular application, openfaas. OpenFaaS gives us a simple way to deploy functions and microservices to Kubernetes with built-in auto-scaling.

arkade install openfaas

Here’s the post-install information:

# Get the faas-clicurl -SLsf https://cli.openfaas.com | sudo sh# If basic auth is enabled, you can now log into your gateway:PASSWORD=$(kubectl get secret -n openfaas basic-auth -o jsonpath="{.data.basic-auth-password}" | base64 --decode; echo)

The IP of my RPi is, so I can access OpenFaaS using a NodePort of 31112.

export OPENFAAS_URL= -n $PASSWORD | faas-cli login --username admin --password-stdinfaas-cli store list --platform armhffaas-cli store deploy figlet --platform armhffaas-cli list

Now open the OpenFaaS UI and check your figlet function using or the equivalent.

You can also build your own functions with Python, Go, JavaScript and many other languages.

If you have a Docker Hub login, then you can try the following, but you’ll need to run it on a separate Raspberry Pi, with docker installed (curl -sSL https://get.docker.com | sudo sh)

export USERNAME=alexellis2
docker login -u $USERNAME
faas-cli template store pull golang-http
faas-cli new --lang golang-http --prefix=$USERNAME my-api
faas-cli up -f my-api.yml# Now invoke your functionfaas-cli invoke my-api -f my-api.yml

You can also edit the function’s code and then run faas-cli up again:

Contents of: my-api/handler.go

package functionimport (
func Handle(req handler.Request) (handler.Response, error) {
return handler.Response{
Body: []byte(`Run k3s on your RPi!`),
StatusCode: http.StatusOK,
}, nil

Find out more about OpenFaaS at openfaas.com

You can also see your functions on the Kubernetes Dashboard:

Get a public IP for your cluster

You can get a public IP for your cluster via a tunnel using the popular Open Source project inlets.

Find out how in this tutorial — which combines cert-manager, nginx-ingress (or Traefik) and the inlets-operator.

Wrapping up and next steps

If you want to take things further, you can start adding additional nodes into the cluster, to extend its capacity and to give redundancy.

You can connect with the OpenFaaS community — to talk about Kubernetes, ARM, Raspberry Pi clusters and serverless. Join our Slack workspace today.

Alex Ellis

Written by

CNCF Ambassador. OpenFaaS & Inlets founder — https://www.alexellis.io

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade