How To Install Kubernetes On A Raspberry Pi

So, you want to get into the world of containerized computing and all the advantages that come with it? 

If that’s the case then you’ve probably already heard about Kubernetes and the wonders it can do, but if you don’t know how to install Kubernetes on Raspberry Pi then don’t worry! I’m here to guide you through the process every step of the way.

Let’s get into it!

What Even Is Kubernetes?

Author, and technology evangelist at Red Hat, Gordon Haff describes Kubernetes as:

“… an open source platform that automates Linux container operations. It eliminates many of the manual processes involved in deploying and scaling containerized applications.”

In other words, you can cluster together groups of hosts running Linux containers, and Kubernetes helps you easily and efficiently manage those clusters.

Anything that helps you stay on top of your projects as they become more complicated is good news in our books, and Kubernetes is winning over the hearts and minds of IT professionals and hobbyists around the world.

kubernetes on a raspberry pi

What You Need To Run Kubernetes On A Raspberry Pi

First things first, to install Kubernetes on Raspberry Pi, you’ll need a few things before getting started:

  1. A Raspberry Pi with at least 2GB RAM
  2. USB power supply for your Raspberry Pi device
  3. An SD card with a storage capacity of at least 8GB or more
  4. Docker Desktop if you’re planning on building your own images
  5. Some basic command line know-how

Top Tip: Kubernetes writes to SD cards a lot and can increase the chances of killing a card, so it’s best to buy multiple smaller cards than just a few excessively large ones.

First You Need To Flash The Initial OS

Once you’ve got everything ready, the first step is to flash the initial OS image onto your Pi’s SD card.

This can be done by flashing a standard ISO image file like the official Ubuntu ISO file for Pi on your device through Etcher.io or Raspberry Pi Imager.

You can also use the desktop version of Ubuntu if you have a USB keyboard and an HDMI cable lying around to pair up your Pi with desktop peripherals. However, for the purpose of this post, we’ll be focusing on using Ubuntu Server for installing Kubernetes on Raspberry Pi.

For Ubuntu Server on Raspberry Pi, after flashing your SD card, enable SSH by adding a blank file named ssh (without any extension) to the root directory of your SD card. This step is crucial as it allows you to connect to your Raspberry Pi remotely without requiring a monitor and keyboard for initial setup.

Alternatively, for the Desktop variant of Ubuntu, if you prefer a direct setup or need to initially configure your system with a GUI, connect your device to a monitor and keyboard. Then, enable SSH through the terminal or settings menu by following the steps provided in the Ubuntu documentation or settings interface to allow remote connections.

  • Update packages using the commands
How To Install Kubernetes On A Raspberry Pi
  • Install OpenSSH
How To Install Kubernetes On A Raspberry Pi
  • Enable SSH
How To Install Kubernetes On A Raspberry Pi
  • Place the SD card in the SD slot on the Raspberry Pi, then turn on your devices
  • Then, using the nmap code or the router’s administrative console, find out the IP addresses of all Raspberry Pis. To prevent IP addresses from changing in the future due to restarts, it is advised to set the router to reserve the IP address for each Raspberry Pi.
How To Install Kubernetes On A Raspberry Pi
  • Lastly, use the default password How To Install Kubernetes On A Raspberry Pi to ssh into your Raspberry Pi devices and replace the default password with a safer one of your chosing.

Install And Configure K3

In this section, we’ll be using the original ansible template and a few extra playbooks to configure and install k3. So be sure to clone the following repositories before getting started:

Ansible Playbook – k3

Ansible Playbook – Pi Configuration

Prepare Docker Container

As a prerequisite you’ll also need to download and run docker. Follow the steps outlined below to get started:

  • Start the Docker container by opening up a terminal window and cd into the directory.
  • Make a copy of the as
  • Initiate kube-tools by running the following code
How To Install Kubernetes On A Raspberry Pi
  • Then approve the container by using the following command
How To Install Kubernetes On A Raspberry Pi
  • After validating the container, SSH into it by running
How To Install Kubernetes On A Raspberry Pi
  • Finally, validate ansible
How To Install Kubernetes On A Raspberry Pi

Setup Playbooks

Follow the steps outlined below to set up your playbooks:

  • cd into the copied ansible repository 
How To Install Kubernetes On A Raspberry Pi
  • Edit with the IP addresses you’ve found previously using the nmap command above and the Pis’ preferred hostname in the format shown below.
How To Install Kubernetes On A Raspberry Pi
  • cd into the copied k3 repository
How To Install Kubernetes On A Raspberry Pi
  • Make a new directory
How To Install Kubernetes On A Raspberry Pi
  • Add the IP addresses acquired above to in the following structure:
How To Install Kubernetes On A Raspberry Pi
  • Finally, set ansible_user to in.

Create RSA Key

  • cd into the copied ansible repository
How To Install Kubernetes On A Raspberry Pi
  • Create RSA key by executing the following playbook
How To Install Kubernetes On A Raspberry Pi
  • Alternatively, you can generate RSA key manually by executing the following commands:
How To Install Kubernetes On A Raspberry Pi
  • Run the following playbook to duplicate RSA keys to all Pi devices
How To Install Kubernetes On A Raspberry Pi
  • Alternatively, the following command can be used to manually copy each Pi’s RSA key as wellHow To Install Kubernetes On A Raspberry Pi

Update Host Name

How To Install Kubernetes On A Raspberry Pi
  • Hostnames can also be updated manually by individually ssh’ing into every Pi device and editing the names in and , and then performing the How To Install Kubernetes On A Raspberry Picommand

Install Kubernetes On Raspberry Pi

  • cd into the copied k3 repository
How To Install Kubernetes On A Raspberry Pi
  • Start the cluster’s provisioning using the following code
How To Install Kubernetes On A Raspberry Pi
  • Get kube config from the master node
How To Install Kubernetes On A Raspberry Pi
  • Then validate the nodes by running
How To Install Kubernetes On A Raspberry Pi

How To Install Kubernetes Dashboard

The Kubernetes Dash is a web-based, general-purpose UI for controlling Kubernetes clusters. Here’s how you can install it on your Pi devices:

  • cd into directory
How To Install Kubernetes On A Raspberry Pi
  • Initiate the dashboard from the official source
How To Install Kubernetes On A Raspberry Pi
  • Confirm the pod status 
How To Install Kubernetes On A Raspberry Pi
  • Create a read-only and an admin user for Kubernetes dashboard by typing the following commands
How To Install Kubernetes On A Raspberry Pi
  • Get secret for dashboard admin user by executing the following lines of code
How To Install Kubernetes On A Raspberry Pi
  • Launch proxy for linking to the dashboard
How To Install Kubernetes On A Raspberry Pi
  • Go to the following URL to open the Kubernetes dashboard in your web browser.
How To Install Kubernetes On A Raspberry Pi
How To Install Kubernetes On A Raspberry Pi

Source: Kubernetes.com

  • Now the kubernetes dashboard and cluster should be up and running in your Pi device ready to execute applications

Top Tip: If you ever need to delete the kubernetes dashboard for any reason, open a terminal window and cd into the directory, and run the following command:

How To Install Kubernetes On A Raspberry Pi
buy raspberry pi accessories

Example Kubernetes Cluster Uses For The Raspberry Pi

Once you’ve got a Kubernetes cluster up and running on your Raspberry Pi devices, there are plenty of different applications that you can use it for. 

From setting up distributed systems to creating IoT networks, and even hosting web services, the possibilities are quite literally endless.

Here are a few amazing examples of some of the most popular Raspberry Pi Kubernetes cluster uses:

  • Building your own homelab and hosting your private GitHub system
  • Self-hosting your private cloud
  • Using it as a NAS storage solution at home or at the office
  • Home automation
  • Hosting your own web server
  • Hosting your Minecraft game server

So, what are you waiting for? Start building your own Kubernetes cluster today!

If you’re someone who is more of a visual learner, make sure you check out this video from Andrew Malkov for his run down on how to install Kubernetes on a Raspberry Pi.

Erik D

2 thoughts on “How To Install Kubernetes On A Raspberry Pi”

  1. “For Ubuntu Pi, add a blank file with the name to the directory of your memory card to enable SSH. ”
    What name for the blank file?

    1. So sorry that I missed that in our article! The name of the file should be ssh . I have fixed that in the article now. Thanks for bringing it to my attention 🙂

Leave a Comment

Your email address will not be published. Required fields are marked *