Step-By-Step Process To Deploy Kubernetes On Your Raspberry PIs!!
Developing and Deploying Kubernetes Applications with MicroK8s on a Raspberry Pi Cluster
Kubernetes is one of orchestration system which is getting popular for the last five years. Google initially makes it, but now it’s maintained by its vast community worldwide. That’s why it might become a new standard for container orchestration. But having a Kubernetes cluster might be a bit expensive. You have to run at least two or three nodes to run the cluster and try several demo projects on that cluster. That could be overkill for someone. But how if we have a Kubernetes that might run in our local computer? That should be an exciting thing.
Hardware Need ( Must Have )
- Raspberry PI (3/4 Min 2GB RAM): Minimum 2 Nodes ( 1 Master Node, 1 Worker Node )
- Power Supply Unit ( 15W Type-C for Rasp4 or You can use POE Hat )
- Ethernet Cable ( Minimum CAT 5e/6 ( Rasp supports up to 1Gbps ))
- Micro SD Card ( Min 8 GB, Recommended 32 GB )
- Good Case With FAN ( Saves your rasp from dirt and excessive heat )
- Etcher or Raspberry PI Imager
- Ubuntu 20.4 64Bit ARM ( OS )
Part — 1: Setup Raspberry PIs
- Use Raspberry PI Imager (Recommended) or Etcher to boot Ubuntu 20.4 64Bit on SD Card
- When Imager flashes the OS in the SD Card, open the boot drive and create a file name
ssh(Without any extension).
- Boot your Rasps
- Check the rasp IP from your router or use Nmap to network scan like this:
nmap -sP 192.168.0.0/24
- SSH to Rasps ( Ex: ssh firstname.lastname@example.org )
- Default username :
ubuntu& default password :
- Do all the basics things you always do with your rasps like setup static IP, setup dot-files, and other stuff.
Part — 2: Setup MicroK8s
Microk8s provides a single command installation of the latest Kubernetes release on a local machine for development and testing. Setup is quick, fast (~30 sec), and supports many plugins, including Istio, with a single command. Since K8s is not the easiest thing to get started with, having a tool that would make it easy for you to get going is very desirable.
microk8s is strictly for Linux. There is no VM involved. It is distributed and runs as a snap — a per-packaged application (similar to a Docker container). Snaps can be used on all major Linux distributions, including Ubuntu, Linux Mint, Debian, and Fedora.
A. Setup Docker and Do Some Other Tweaks Before Installing Kubernetes
It is not a surprise we are going to use Docker Engine for the container runtime. Despite there are alternatives in rkt, cri-o, and others. However, at a closer look, we can see Kubernetes uses containers. We use docker because it is the most famous container system and relatively easy to deploy.
B. Setup MicroK8s
You may follow the installation instruction of MicroK8S in the official documentation.
Start with installing MicroK8s using Snap which will take only a few seconds.
C. Access the Kubernetes Dashboard
D. Add Nodes To The Cluster
E. Deploy Some Fun
E1. Install Portainer
Portainer is a lightweight management UI that allows you to manage your different Docker environments easily. Portainer provides an easy and straightforward solution for managing Docker containers and Swarm services through a web interface. Portainer supports a wide range of features for managing the Docker containers, such as controlling the creation and deletion of Swarm services, user authentication, authorizations, connecting, executing commands in the console of running containers viewing containers’ logs.
E2. Install Linkding ( Bookmark Manager )
Linkding is a self-hosted bookmark service : sissbruecker/linkding
E3. Install Code-server
Code-server is nothing but VS Code on the browser ( To use on any machine anywhere and access it in the browser. ) : codercom/code-server
You should now have an operational Kubernetes master and several worker nodes ready to accept workloads.
I hope MicroK8 will be a great help for newcomers into Kubernetes to try it out and learn Kubernetes by playing with it.