This guide is to create a HA Kubernetes cluster on Raspberry Pis. Whether you’re a beginner or advanced Kubernetes user this guide is for you…

Image for post


The Raspbernetes project started with a goal to automate the setup and management of a Kubernetes cluster on Raspberry Pis. It aims to be completely declarative and idempotent.

It demonstrates how to implement enterprise-grade security, observability, and overall cluster management in a learning environment.

Check out more about the project → https://github.com/raspbernetes

Prerequisites

Hardware — It’s recommended to have at least 4 raspberry pis as a minimum. Through this guide 3 will be used as master nodes, and 1 will be used as a worker node, however, having more is completely fine.

Software — You will need the following CLI tools to be able to follow the steps in this guide:

Finally, you will need to clone this repository: https://github.com/raspbernetes/k8s-cluster-installation

Flash SD Cards

To configure each node with a unique IP and hostname we use cloud-init. This is a method for cross-platform cloud instance initialization which also works for bare-metal installations.

The operating system used in this guide will be Ubuntu 20.04, run the following command to download the image:

# Download the Ubuntu 20.04 Focal image for Raspberry Pis
curl -L "http://cdimage.ubuntu.com/releases/focal/release/ubuntu-  20.04-preinstalled-server-arm64+raspi.img.xz" -o ~/Downloads/ubuntu-20.04-preinstalled-server-arm64+raspi.img.xz
# Extract the downloaded files
unxz -T 0 ~/Downloads/ubuntu-20.04-preinstalled-server-arm64+raspi.img.xz

The following steps will configure networking for the nodes automatically using cloud-init on boot( steps 4 to 6 must be repeated for each node):

  1. Open the cloud-config file.
  2. Update the gateway4 value to match the IP of your router. (If unsure you can find this IP using this guide)
  3. Update the ssh_authorized_keys value with your own keys, enabling secure SSH access to each node without further configuration. (Highly recommended and there are a lot of guides that will explain how to setup SSH keys if you haven’t already)
  4. Update the hostname value to be unique per node.
  5. Update the addresses value to be a unique IP per node.
  6. Flash the OS image and cloud-init configuration onto the Raspberry Pi using the following command:
flash \
  --userdata setup/cloud-config.yml \
  ~/Downloads/ubuntu-20.04-preinstalled-server-arm64+raspi.img

#raspberry-pi #docker #devops #kubernetes #networking

Automated HA Kubernetes deployment on Raspberry Pis
1.50 GEEK