From ee75979b5d94ae18f930ff91e5b2d51cd554b60d Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Mon, 9 Mar 2026 22:45:54 +0200 Subject: Update content for html --- ...4-12-03-f3s-kubernetes-with-freebsd-part-2.html | 291 ++++++++++----------- 1 file changed, 143 insertions(+), 148 deletions(-) (limited to 'gemfeed/2024-12-03-f3s-kubernetes-with-freebsd-part-2.html') diff --git a/gemfeed/2024-12-03-f3s-kubernetes-with-freebsd-part-2.html b/gemfeed/2024-12-03-f3s-kubernetes-with-freebsd-part-2.html index b9e3c2f0..5578fbf1 100644 --- a/gemfeed/2024-12-03-f3s-kubernetes-with-freebsd-part-2.html +++ b/gemfeed/2024-12-03-f3s-kubernetes-with-freebsd-part-2.html @@ -2,17 +2,12 @@ - f3s: Kubernetes with FreeBSD - Part 2: Hardware and base installation -
-
-
-

Home | Markdown | Gemini

@@ -137,9 +132,9 @@ by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
[paul@earth]~/Downloads% sudo dd \
-  if=FreeBSD-14.1-RELEASE-amd64-bootonly.iso \
-  of=/dev/sda conv=sync
+
[paul@earth]~/Downloads% sudo dd \
+  if=FreeBSD-14.1-RELEASE-amd64-bootonly.iso \
+  of=/dev/sda conv=sync
 

Next, I plugged the Beelinks (one after another) into my monitor via HDMI (the resolution of the FreeBSD text console seems strangely stretched, as I am using the LG Dual Up monitor), connected Ethernet, an external USB keyboard, and the FreeBSD USB stick, and booted the devices up. With F7, I entered the boot menu and selected the USB stick for the FreeBSD installation.
@@ -165,9 +160,9 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
root@f0:~ # freebsd-update fetch
-root@f0:~ # freebsd-update install
-root@f0:~ # freebsd-update reboot
+
root@f0:~ # freebsd-update fetch
+root@f0:~ # freebsd-update install
+root@f0:~ # freebsd-update reboot
 

I also added the following entries for the three FreeBSD boxes to the /etc/hosts file:
@@ -176,11 +171,11 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
root@f0:~ # cat <<END >>/etc/hosts
-192.168.1.130 f0 f0.lan f0.lan.buetow.org
-192.168.1.131 f1 f1.lan f1.lan.buetow.org
-192.168.1.132 f2 f2.lan f2.lan.buetow.org
-END
+
root@f0:~ # cat <<END >>/etc/hosts
+192.168.1.130 f0 f0.lan f0.lan.buetow.org
+192.168.1.131 f1 f1.lan f1.lan.buetow.org
+192.168.1.132 f2 f2.lan f2.lan.buetow.org
+END
 

You might wonder why bother using the hosts file? Why not use DNS properly? The reason is simplicity. I don't manage 100 hosts, only a few here and there. Having an OpenWRT router in my home, I could also configure everything there, but maybe I'll do that later. For now, keep it simple and straightforward.
@@ -193,7 +188,7 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
root@f0:~ # pkg install helix doas zfs-periodic uptimed
+
root@f0:~ # pkg install helix doas zfs-periodic uptimed
 

Helix editor


@@ -210,7 +205,7 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
root@f0:~ # cp /usr/local/etc/doas.conf.sample /usr/local/etc/doas.conf
+
root@f0:~ # cp /usr/local/etc/doas.conf.sample /usr/local/etc/doas.conf
 

https://man.openbsd.org/doas
@@ -223,17 +218,17 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
root@f0:~ # cat <<END >>/etc/periodic.conf
-daily_zfs_snapshot_enable="YES"
-daily_zfs_snapshot_pools="zroot"
-daily_zfs_snapshot_keep="7"
-weekly_zfs_snapshot_enable="YES"
-weekly_zfs_snapshot_pools="zroot"
-weekly_zfs_snapshot_keep="5"
-monthly_zfs_snapshot_enable="YES"
-monthly_zfs_snapshot_pools="zroot"
-monthly_zfs_snapshot_keep="6"
-END
+
root@f0:~ # cat <<END >>/etc/periodic.conf
+daily_zfs_snapshot_enable="YES"
+daily_zfs_snapshot_pools="zroot"
+daily_zfs_snapshot_keep="7"
+weekly_zfs_snapshot_enable="YES"
+weekly_zfs_snapshot_pools="zroot"
+weekly_zfs_snapshot_keep="5"
+monthly_zfs_snapshot_enable="YES"
+monthly_zfs_snapshot_pools="zroot"
+monthly_zfs_snapshot_keep="6"
+END
 

https://github.com/ross/zfs-periodic
@@ -248,9 +243,9 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
root@f0:~ # cp /usr/local/mimecast/etc/uptimed.conf-dist \
-  /usr/local/mimecast/etc/uptimed.conf 
-root@f0:~ # hx /usr/local/mimecast/etc/uptimed.conf
+
root@f0:~ # cp /usr/local/mimecast/etc/uptimed.conf-dist \
+  /usr/local/mimecast/etc/uptimed.conf 
+root@f0:~ # hx /usr/local/mimecast/etc/uptimed.conf
 

In the Helix editor session, I changed LOG_MAXIMUM_ENTRIES to 0 to keep all uptime entries forever and not cut off at 50 (the default config). After that, I enabled and started uptimed:
@@ -259,8 +254,8 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
root@f0:~ # service uptimed enable
-root@f0:~ # service uptimed start
+
root@f0:~ # service uptimed enable
+root@f0:~ # service uptimed start
 

To check the current uptime stats, I can now run uprecords:
@@ -269,15 +264,15 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
 root@f0:~ # uprecords
-     #               Uptime | System                                     Boot up
-----------------------------+---------------------------------------------------
-->   1     0 days, 00:07:34 | FreeBSD 14.1-RELEASE      Mon Dec  2 12:21:44 2024
-----------------------------+---------------------------------------------------
-NewRec     0 days, 00:07:33 | since                     Mon Dec  2 12:21:44 2024
-    up     0 days, 00:07:34 | since                     Mon Dec  2 12:21:44 2024
-  down     0 days, 00:00:00 | since                     Mon Dec  2 12:21:44 2024
-   %up              100.000 | since                     Mon Dec  2 12:21:44 2024
+
 root@f0:~ # uprecords
+     #               Uptime | System                                     Boot up
+----------------------------+---------------------------------------------------
+->   1     0 days, 00:07:34 | FreeBSD 14.1-RELEASE      Mon Dec  2 12:21:44 2024
+----------------------------+---------------------------------------------------
+NewRec     0 days, 00:07:33 | since                     Mon Dec  2 12:21:44 2024
+    up     0 days, 00:07:34 | since                     Mon Dec  2 12:21:44 2024
+  down     0 days, 00:00:00 | since                     Mon Dec  2 12:21:44 2024
+   %up              100.000 | since                     Mon Dec  2 12:21:44 2024
 

This is how I track the uptimes for all of my host:
@@ -295,17 +290,17 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
paul@f0:~ % ifconfig re0
-re0: flags=1008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500
-        options=8209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC,LINKSTATE>
-        ether e8:ff:1e:d7:1c:ac
-        inet 192.168.1.130 netmask 0xffffff00 broadcast 192.168.1.255
-        inet6 fe80::eaff:1eff:fed7:1cac%re0 prefixlen 64 scopeid 0x1
-        inet6 fd22:c702:acb7:0:eaff:1eff:fed7:1cac prefixlen 64 detached autoconf
-        inet6 2a01:5a8:304:1d5c:eaff:1eff:fed7:1cac prefixlen 64 autoconf pltime 10800 vltime 14400
-        media: Ethernet autoselect (1000baseT <full-duplex>)
-        status: active
-        nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
+
paul@f0:~ % ifconfig re0
+re0: flags=1008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500
+        options=8209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC,LINKSTATE>
+        ether e8:ff:1e:d7:1c:ac
+        inet 192.168.1.130 netmask 0xffffff00 broadcast 192.168.1.255
+        inet6 fe80::eaff:1eff:fed7:1cac%re0 prefixlen 64 scopeid 0x1
+        inet6 fd22:c702:acb7:0:eaff:1eff:fed7:1cac prefixlen 64 detached autoconf
+        inet6 2a01:5a8:304:1d5c:eaff:1eff:fed7:1cac prefixlen 64 autoconf pltime 10800 vltime 14400
+        media: Ethernet autoselect (1000baseT <full-duplex>)
+        status: active
+        nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
 

RAM


@@ -316,8 +311,8 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
paul@f0:~ % sysctl hw.physmem
-hw.physmem: 16902905856
+
paul@f0:~ % sysctl hw.physmem
+hw.physmem: 16902905856
 
 

@@ -329,11 +324,11 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
paul@f0:~ % sysctl dev.cpu | grep freq:
-dev.cpu.3.freq: 705
-dev.cpu.2.freq: 705
-dev.cpu.1.freq: 604
-dev.cpu.0.freq: 604
+
paul@f0:~ % sysctl dev.cpu | grep freq:
+dev.cpu.3.freq: 705
+dev.cpu.2.freq: 705
+dev.cpu.1.freq: 604
+dev.cpu.0.freq: 604
 

CPU throttling


@@ -344,14 +339,14 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
paul@f0:~ % doas pkg install ubench
-paul@f0:~ % rehash # For tcsh to find the newly installed command
-paul@f0:~ % ubench &
-paul@f0:~ % sysctl dev.cpu | grep freq:
-dev.cpu.3.freq: 2922
-dev.cpu.2.freq: 2922
-dev.cpu.1.freq: 2923
-dev.cpu.0.freq: 2922
+
paul@f0:~ % doas pkg install ubench
+paul@f0:~ % rehash # For tcsh to find the newly installed command
+paul@f0:~ % ubench &
+paul@f0:~ % sysctl dev.cpu | grep freq:
+dev.cpu.3.freq: 2922
+dev.cpu.2.freq: 2922
+dev.cpu.1.freq: 2923
+dev.cpu.0.freq: 2922
 

Idle, all three Beelinks plus the switch consumed 26.2W. But with ubench stressing all the CPUs, it went up to 38.8W.
@@ -374,7 +369,7 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
[paul@earth]~% sudo dnf install -y wol
+
[paul@earth]~% sudo dnf install -y wol
 

Next, I created a simple script (~/bin/wol-f3s) to wake and shutdown the machines:
@@ -383,68 +378,68 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
#!/bin/bash
-# Wake-on-LAN and shutdown script for f3s cluster (f0, f1, f2)
+
#!/bin/bash
+# Wake-on-LAN and shutdown script for f3s cluster (f0, f1, f2)
 
-# MAC addresses
-F0_MAC="e8:ff:1e:d7:1c:ac"  # f0 (192.168.1.130)
-F1_MAC="e8:ff:1e:d7:1e:44"  # f1 (192.168.1.131)
-F2_MAC="e8:ff:1e:d7:1c:a0"  # f2 (192.168.1.132)
+# MAC addresses
+F0_MAC="e8:ff:1e:d7:1c:ac"  # f0 (192.168.1.130)
+F1_MAC="e8:ff:1e:d7:1e:44"  # f1 (192.168.1.131)
+F2_MAC="e8:ff:1e:d7:1c:a0"  # f2 (192.168.1.132)
 
-# IP addresses
-F0_IP="192.168.1.130"
-F1_IP="192.168.1.131"
-F2_IP="192.168.1.132"
+# IP addresses
+F0_IP="192.168.1.130"
+F1_IP="192.168.1.131"
+F2_IP="192.168.1.132"
 
-# SSH user
-SSH_USER="paul"
+# SSH user
+SSH_USER="paul"
 
-# Broadcast address for your LAN
-BROADCAST="192.168.1.255"
+# Broadcast address for your LAN
+BROADCAST="192.168.1.255"
 
-wake() {
-    local name=$1
-    local mac=$2
-    echo "Sending WoL packet to $name ($mac)..."
-    wol -i "$BROADCAST" "$mac"
-}
+wake() {
+    local name=$1
+    local mac=$2
+    echo "Sending WoL packet to $name ($mac)..."
+    wol -i "$BROADCAST" "$mac"
+}
 
-shutdown_host() {
-    local name=$1
-    local ip=$2
-    echo "Shutting down $name ($ip)..."
-    ssh -o ConnectTimeout=5 "$SSH_USER@$ip" "doas poweroff" 2>/dev/null && \
-        echo "  ✓ Shutdown command sent to $name" || \
-        echo "  ✗ Failed to reach $name (already down?)"
-}
+shutdown_host() {
+    local name=$1
+    local ip=$2
+    echo "Shutting down $name ($ip)..."
+    ssh -o ConnectTimeout=5 "$SSH_USER@$ip" "doas poweroff" 2>/dev/null && \
+        echo "  ✓ Shutdown command sent to $name" || \
+        echo "  ✗ Failed to reach $name (already down?)"
+}
 
-ACTION="${1:-all}"
+ACTION="${1:-all}"
 
-case "$ACTION" in
-    f0) wake "f0" "$F0_MAC" ;;
-    f1) wake "f1" "$F1_MAC" ;;
-    f2) wake "f2" "$F2_MAC" ;;
-    all|"")
-        wake "f0" "$F0_MAC"
-        wake "f1" "$F1_MAC"
-        wake "f2" "$F2_MAC"
-        ;;
-    shutdown|poweroff|down)
-        shutdown_host "f0" "$F0_IP"
-        shutdown_host "f1" "$F1_IP"
-        shutdown_host "f2" "$F2_IP"
-        echo ""
-        echo "✓ Shutdown commands sent to all machines."
-        exit 0
-        ;;
-    *)
-        echo "Usage: $0 [f0|f1|f2|all|shutdown]"
-        exit 1
-        ;;
-esac
+case "$ACTION" in
+    f0) wake "f0" "$F0_MAC" ;;
+    f1) wake "f1" "$F1_MAC" ;;
+    f2) wake "f2" "$F2_MAC" ;;
+    all|"")
+        wake "f0" "$F0_MAC"
+        wake "f1" "$F1_MAC"
+        wake "f2" "$F2_MAC"
+        ;;
+    shutdown|poweroff|down)
+        shutdown_host "f0" "$F0_IP"
+        shutdown_host "f1" "$F1_IP"
+        shutdown_host "f2" "$F2_IP"
+        echo ""
+        echo "✓ Shutdown commands sent to all machines."
+        exit 0
+        ;;
+    *)
+        echo "Usage: $0 [f0|f1|f2|all|shutdown]"
+        exit 1
+        ;;
+esac
 
-echo ""
-echo "✓ WoL packets sent. Machines should boot in a few seconds."
+echo ""
+echo "✓ WoL packets sent. Machines should boot in a few seconds."
 

After making the script executable with chmod +x ~/bin/wol-f3s, I can now control the machines with simple commands:
@@ -453,9 +448,9 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
[paul@earth]~% wol-f3s          # Wake all three
-[paul@earth]~% wol-f3s f0       # Wake only f0
-[paul@earth]~% wol-f3s shutdown # Shutdown all three via SSH
+
[paul@earth]~% wol-f3s          # Wake all three
+[paul@earth]~% wol-f3s f0       # Wake only f0
+[paul@earth]~% wol-f3s shutdown # Shutdown all three via SSH
 

Testing WoL and Shutdown


@@ -466,15 +461,15 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
[paul@earth]~% wol-f3s shutdown
-Shutting down f0 (192.168.1.130)...
-  ✓ Shutdown command sent to f0
-Shutting down f1 (192.168.1.131)...
-  ✓ Shutdown command sent to f1
-Shutting down f2 (192.168.1.132)...
-  ✓ Shutdown command sent to f2
+
[paul@earth]~% wol-f3s shutdown
+Shutting down f0 (192.168.1.130)...
+  ✓ Shutdown command sent to f0
+Shutting down f1 (192.168.1.131)...
+  ✓ Shutdown command sent to f1
+Shutting down f2 (192.168.1.132)...
+  ✓ Shutdown command sent to f2
 
-✓ Shutdown commands sent to all machines.
+✓ Shutdown commands sent to all machines.
 

After waiting for them to fully power down (about 1 minute), I sent the WoL magic packets:
@@ -483,15 +478,15 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
[paul@earth]~% wol-f3s
-Sending WoL packet to f0 (e8:ff:1e:d7:1c:ac)...
-Waking up e8:ff:1e:d7:1c:ac...
-Sending WoL packet to f1 (e8:ff:1e:d7:1e:44)...
-Waking up e8:ff:1e:d7:1e:44...
-Sending WoL packet to f2 (e8:ff:1e:d7:1c:a0)...
-Waking up e8:ff:1e:d7:1c:a0...
+
[paul@earth]~% wol-f3s
+Sending WoL packet to f0 (e8:ff:1e:d7:1c:ac)...
+Waking up e8:ff:1e:d7:1c:ac...
+Sending WoL packet to f1 (e8:ff:1e:d7:1e:44)...
+Waking up e8:ff:1e:d7:1e:44...
+Sending WoL packet to f2 (e8:ff:1e:d7:1c:a0)...
+Waking up e8:ff:1e:d7:1c:a0...
 
-✓ WoL packets sent. Machines should boot in a few seconds.
+✓ WoL packets sent. Machines should boot in a few seconds.
 

Within 30-50 seconds, all three machines successfully booted up and became accessible via SSH!
@@ -512,7 +507,7 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> -
[paul@earth]~% wol-f3s shutdown
+
[paul@earth]~% wol-f3s shutdown
 

And all three machines will shut down cleanly. The next time I need them, a simple wol-f3s command wakes them all back up. This combination makes the cluster very energy-efficient while maintaining quick access when needed.
@@ -560,11 +555,11 @@ http://www.gnu.org/software/src-highlite -->
Back to the main site
-- cgit v1.2.3