Skip to content

Personal project to deploy K8s and Linkerd on Rpi 4 using Ansible.

License

Notifications You must be signed in to change notification settings

lessandro-ugulino/cluster-k8s-rpi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Project: Kubernetes cluster using Raspberry Pi 4

⚠️ I am still working on this project. I'll release the services as soon as it's done

Index

Hardware

  • 3 Raspberry Pi 4, 4Gb each
  • 1 Raspberry Pi 4, 8Gb
  • 4 Micro SDXC SanDisk 128Gb each (64Gb will be enough as well)
  • 4 Cables Ugreen USB C to USB A
  • 1 Micro-HDMI to standard HDMI
  • 1 GeeekPi Rack Tower 4 Layer Acrylic Cluster Case Large Cooling Fan LED RGB Light.
  • 1 Anker 60W 6-Port USB Wall Charger, amazon link

Diagram

diagram

Requirements

  1. The first step is to install the OS, for this project I'd choose Ubuntu Server 20.04.3 LTS. Step by step is here.

  2. Install Ansible on your local computer.

  3. Install sshpass on MAC

brew install hudochenkov/sshpass/sshpass

Setting up

Ip Address

As specified on the official documentation, we can set up the wifi connection by modifying the file network-config.

Cluster IP addresses.

Hostname IP Address
rpi-k8s-master 192.168.1.123
rpi-k8s-node-1 192.168.1.164
rpi-k8s-node-2 192.168.1.111
rpi-k8s-storage 192.168.1.175

Also, as I set up the Rpi to not use a static IP address, once the devices got the respective IPs, I bound this to each respective MAC Address on my router.

router

Ansible hosts file

The Inventory hosts file needs to be updated with the Rpi Ip address.

The file is located at /inventory/hosts

[all:vars]
ansible_connection=ssh
ansible_user=ubuntu
ansible_ssh_pass=Y8WJq84Y #your ubuntu password

[master]
rpi-k8s-master  ansible_host=192.168.1.123

[nodes]
rpi-k8s-node-1  ansible_host=192.168.1.164
rpi-k8s-node-2  ansible_host=192.168.1.111

[storage]
rpi-k8s-storage  ansible_host=192.168.1.175

Group Vars

This file contains information to be used on K8s services. Update it accordingly.

IpAddress:
  k8s_master: 192.168.1.123
  k8s_node_1: 192.168.1.164
  k8s_node_2: 192.168.1.111
  k8s_storage: 192.168.1.175

K8s:
  cluster_name: cluster-rpi-lessandro
  podSubnet: "10.244.0.0/16"
  version: 1.22.0-00 #Kubernetes version to be installed

AWS:
  HOSTED_ZONE_ID: ABCDE #Your Route53 Zone Id - K8s Dynamic DNS Services
  VPN_NAME: example.com #Your public record - K8s Dynamic DNS Services
  default_region: ap-southeast-2 #Your default AWS Region

Applications

⚠️ Make sure you read the documentation before deploying the applications.

Name URL Username Password Documentation
Linkerd http://192.168.1.164:32100 N/A N/A link
Kubernetes Dashboard https://192.168.1.164:32200 N/A N/A link
Dynamic DNS N/A N/A N/A link
Wireguard N/A N/A N/A link
NFS Server N/A N/A N/A link
Jenkins & Trivy http://192.168.1.164:32000 admin P@ssw0rd link
Pi-hole http://192.168.1.164:8000 admin link
Grafana http://192.168.1.164:32000 admin admin link
Prometheus http://192.168.1.164:32090 N/A N/A link
Alertmanager http://192.168.1.164:32093 N/A N/A link

Deploy

Run the below Ansible playbook command.

ansible-playbook deploy

It'll deploy the services and applications specified on deploy.yml file.

Images

Raspberry Pi

rpi-1

rpi-2

rpi-3

Case

case-1

case-2

case-3

case-4

About

Personal project to deploy K8s and Linkerd on Rpi 4 using Ansible.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages