Topics include Supply Chain Security, Microservice 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 this follow-up blog, I will help you prepare 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. The use of subdomains and sub-sub-domains work too as in the example below.
$ dig ortelius.local.gd
ortelius.local.gd. 86400 IN A 127.0.0.1
$ dig www.ortelius.local.gd
www.ortelius.local.gd. 86400 IN A 127.0.0.1
$ dig aliens.are.real.ortelius.local.gd
aliens.are.real.ortelius.local.gd. 86400 IN A 127.0.0.1
$ dig xrpl.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 it is complete protection for all your devices no matter where you go in the world including your Pi MicroK8s nodes. It will use 127.0.0.1:53
to resolve your local IPs. However, you will need to do some configuration by logging into the NextDNS portal to add local DNS records and installing the cli.
Disclaimer - NextDNS is free up to 300 000 DNS queries once you reach that limit resolution stops. It is inexpensive and totally worth it.
sh -c 'sh -c "$(curl -sL https://nextdns.io/install)"'
sudo nextdns config
to view your config.sudo nextdns config edit
to edit for each Pi and NAS and configure like this:debug 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 service.sudo nextdns status
to check the service status.Settings.
Rewrites
NextDNS will instantly auto refresh all your NextDNS agents with any configuration changes.
Great! DNS is done.
Synology DS413j with DSM 6.2.4-25556 Update 7
so the following steps will be inline with my Synology.File 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
tab.Local users
drop down and give the admin
Read/Write
permissions by checking the box.NFS Permissions
and then Create.
OK.
sudo apt update -y && sudo apt upgrade -y
and then go make coffee.sudo apt install nfs-common -y
for each Pi.your 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 machine.FYI
there are commands related to MickroK8s
such as sudo microk8s config
which are run on the Pis where MicroK8s is installed.sudo 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 to generate a unique key for each node you wish to join.(NOT THE NODE YOU RAN add-node FROM)
<– Taken from Canonicals docs.# 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
Use the '--worker' flag to join a node as a worker not running the control plane, eg:
microk8s join 192.168.1.230:25000/92b2db237428470dc4fcfc4ebbd9dc81/2c0cb3284b05 --worker
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
By this stage you should have three Pi’s each with NFS and MicroK8s. Stay tuned for Part 3 where we will deploy the NSF csi-driver-nfs for Kubernetes, deploy MetalLB load balancer, deploy Traefik and Ortelius.
How to Bake an Ortelius Pi - Part 3 The Configuration
Disclaimer: Any brands I mention in this blog post series are not monetized. This is my home setup!