Topics include Supply Chain Security, Vulnerability Management, Neat Tricks, and Contributor insights.
In part 1, of this series we installed Ubuntu Server 22.04.4 LTS on our Raspberry Pis. In Part 2 we will prepare our three Pis for DHCP, DNS, NFS (Network File System) storage with a Synology NAS and install MicroK8s.
We need to give the Pis a home address so that they are contactable and this is where either a static IP addresse or DHCP comes in. Your home internet router generally comes with DHCP pre-configured. I use the tp-link | AX5400 Wi-Fi 6 Router and so I will use my router as the example here.
Network
–> DHCP Server
If you don’t have something like NextDNS or similar you can use local.gd
which works very well and is very easy to setup.
A easy way to serve localhost is to use DNS that always resolves to 127.0.0.1. For example you could use ortelius.local.gd when developing locally and it will resolve to 127.0.0.1. Any subdomain like *.local.gd will work. Its the easiest way to serve localhost as its DNS that always resolves to 127.0.0.1.
$ dig startup.local.gd
ortelius.local.gd. 86400 IN A 127.0.0.1
$ dig www.startup.local.gd
www.ortelius.local.gd. 86400 IN A 127.0.0.1
$ dig my.project.company.local.gd
aliens.are.real.ortelius.local.gd. 86400 IN A 127.0.0.1
$ dig alderaan.local.gd
xrpl.local.gd. 86400 IN A 127.0.0.10.0.1
sudo vi /etc/hosts
windows\System32\drivers\etc\hosts
For DNS I use NextDNS but this is not just DNS its complete protection for all your devices no matter where you go in the world for all your devices including your Pi MicroK8s nodes. It will use 127.0.0.1:53
to resolve your local IPs but to do that we need to do some configuration by logging into the NextDNS portal and installing the cli.
NextDNS is free up to 300,000 queries/month
, once you reach that limit resolution stops.
pangarabbit.com
sh -c 'sh -c "$(curl -sL https://nextdns.io/install)"'
sudo nextdns config
to view your configsudo nextdns config edit
to edit for each Pi and NAS and configure like thisdebug false
cache-size 10MB
max-ttl 5s
mdns all
cache-max-age 0s
use-hosts true
auto-activate true
listen localhost:53
profile <your profile id goes here>
log-queries false
report-client-info true
discovery-dns
hardened-privacy false
timeout 5s
setup-router false
control /var/run/nextdns.sock
detect-captive-portals false
bogus-priv true
max-inflight-requests 256
sudo nextdns restart
to restart the servicesudo nextdns status
to check the service statusSettings
Rewrites
Great DNS is done!
Synology DS413j with DSM 6.2.4-25556 Update 7
so the following steps will be inline with my SynologyFile Services
SMB/AFP/NFS
tab and scroll until you see NFS
and enable NFS and enable NFSv4 support
File Sharing
Create
Pi8s
Shared Folder
and select Edit
Permissions
tabLocal users
drop down and give the admin
Read/Write
permissions by checking the boxNFS Permissions
and then Create
OK
192.168.0.0/24
indicates that only the devices on this subnet can access NFS192.168.0.0/24
with your network subnet which you can get from your DHCP configurationCongrats you just configured the Synology for NFS!
sudo apt update -y && sudo apt upgrade -y
then go and make coffeeyour local machine
your local machine
brew install helm
generally used on Macchoco install kubernetes-helm
FYI
there are commands related to Kubectl
such as kubectl get nodes
which are run from your machineFYI
there are commands related to MickroK8s
such as sudo microk8s config
which are run on the Pis where MicroK8s is installedsudo vi /boot/firmware/cmdline.txt
and add the following cgroup_enable=memory cgroup_memory=1
cgroup_enable=memory cgroup_memory=1 console=serial0,115200 dwc_otg.lpm_enable=0 console=tty1 root=LABEL=writable rootfstype=ext4 rootwait fixrtc quiet splash
sudo apt install linux-modules-extra-raspi
sudo snap install microk8s --classic
MicroK8s uses Dqlite as a highly available SQLite database to store the Kubernetes logic without any configuration. In Canonicals own words High-availability SQLite Dqlite is a fast, embedded, persistent SQL database with Raft consensus that is perfect for fault-tolerant IoT and Edge devices.
pi01
pi01
and run this command on pi01
sudo microk8s add-node
3 times
on the same node and each time you will need to copy the unique join instruction with the unique key
for each node you wish to join(NOT THE NODE YOU RAN add-node FROM)
# Example from Canonicals docs
From the node you wish to join to this cluster, run the following:
microk8s join 192.168.1.230:25000/92b2db237428470dc4fcfc4ebbd9dc81/2c0cb3284b05
If the node you are adding is not reachable through the default interface you can use one of the following:
microk8s join 192.168.1.230:25000/92b2db237428470dc4fcfc4ebbd9dc81/2c0cb3284b05
microk8s join 10.23.209.1:25000/92b2db237428470dc4fcfc4ebbd9dc81/2c0cb3284b05
microk8s join 172.17.0.1:25000/92b2db237428470dc4fcfc4ebbd9dc81/2c0cb3284b05
sudo microk8s config
kube config
/Users/<username>/.kube/config
- cluster:
certificate-authority-data: <your certificate authority data goes here>
server: https://<your local network IP for your Pi goes here>:16443
name: microk8s-cluster
- context:
cluster: microk8s-cluster
namespace: default
user: <your user goes here>
name: microk8s
users:
- name: <your user goes here>
user:
client-certificate-data: <your client certificate data goes here>
kubectl config view
kubectl config get-context
kubectl config use-context microk8s
kubectl get ns
kubectl get pods --all-namespaces
Well done you have now setup your Microk8s Kubernetes cluster with DHCP, DNS and preparation for NFS.
By this stage you should have three Pi’s each with MicroK8s in an HA configuration and a Synology ready with NFS for centralised storage. Stay tuned for Part 3 where we will use GitOps using Gimlet as the UI to Fluxcd to deploy the following CSI Driver NFS for Kubernetes, Cert Manager, MetalLB Load Balancer, Traefik Proxy and Ortelius.
How to Bake an Ortelius Pi | Part 3 | The GitOps Configuration