summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-01-26 23:22:25 +0200
committerPaul Buetow <paul@buetow.org>2025-01-26 23:22:25 +0200
commitad5aa880195a3efcd031d276009c630e02e2aff4 (patch)
treea9d1f6810c55538b95a4e9a20ef6ff099deb4376
parenta8dc34f1200892637acbfae95372931ad688baf5 (diff)
Update content for md
-rw-r--r--about/podcasts.txt1
-rw-r--r--gemfeed/4 (renamed from gemfeed/DRAFT-f3s-kubernetes-with-freebsd-bhyve.md)114
-rw-r--r--gemfeed/DRAFT-f3s-kubernetes-with-freebsd-part-3.md360
-rw-r--r--gemfeed/f3s-kubernetes-with-freebsd-part-3/apc-back-ups.jpgbin0 -> 295558 bytes
-rw-r--r--gemfeed/f3s-kubernetes-with-freebsd-part-3/f3s-changes.jpgbin0 -> 54543 bytes
5 files changed, 442 insertions, 33 deletions
diff --git a/about/podcasts.txt b/about/podcasts.txt
index 19e38523..182d02cc 100644
--- a/about/podcasts.txt
+++ b/about/podcasts.txt
@@ -9,3 +9,4 @@
* Maintainable
* Fork Around And Find Out
* The ProdCast (Google SRE Podcast)
+* BSD Now
diff --git a/gemfeed/DRAFT-f3s-kubernetes-with-freebsd-bhyve.md b/gemfeed/4
index d9932801..f4c59789 100644
--- a/gemfeed/DRAFT-f3s-kubernetes-with-freebsd-bhyve.md
+++ b/gemfeed/4
@@ -2,23 +2,11 @@
This is the third blog post about my f3s series for my self-hosting demands in my home lab. f3s? The "f" stands for FreeBSD, and the "3s" stands for k3s, the Kubernetes distribution we will use on FreeBSD-based physical machines.
-[2024-11-17 f3s: Kubernetes with FreeBSD - Part 1: Setting the stage](./2024-11-17-f3s-kubernetes-with-freebsd-part-1.md)
-[2024-12-03 f3s: Kubernetes with FreeBSD - Part 2: Hardware and base installation](./2024-12-03-f3s-kubernetes-with-freebsd-part-2.md)
+<< template::inline::index f3s-kubernetes-with-freebsd-part
-[![f3s logo](./f3s-kubernetes-with-frhyveeebsd-part-1/f3slogo.png "f3s logo")](./f3s-kubernetes-with-frhyveeebsd-part-1/f3slogo.png)
+=> ./f3s-kubernetes-with-frhyveeebsd-part-1/f3slogo.png f3s logo
-## Table of Contents
-
-* [⇢ f3s: Kubernetes with FreeBSD - Rocky Linux Bhyve VMs - Part 3](#f3s-kubernetes-with-freebsd---rocky-linux-bhyve-vms---part-3)
-* [⇢ ⇢ Introduction](#introduction)
-* [⇢ ⇢ Basic Bhyve setup](#basic-bhyve-setup)
-* [⇢ ⇢ Rocky Linux VMs](#rocky-linux-vms)
-* [⇢ ⇢ ⇢ ISO download](#iso-download)
-* [⇢ ⇢ ⇢ VM configuration](#vm-configuration)
-* [⇢ ⇢ ⇢ VM installation](#vm-installation)
-* [⇢ ⇢ ⇢ Increase of the disk image](#increase-of-the-disk-image)
-* [⇢ ⇢ ⇢ Connect to VPN](#connect-to-vpn)
-* [⇢ ⇢ After install](#after-install)
+<< template::inline::toc
## Introduction
@@ -32,7 +20,7 @@ Bhyve supports running a variety of guest operating systems, including FreeBSD,
For the management of the Bhyve VMs, we are using `vm-bhyve`, a tool not part of the FreeBSD operating system but available as a ready-to-use package. It eases VM management and reduces a lot of the overhead. We also install the required package to make Bhyve work with the UEFI firmware.
-[https://github.com/churchers/vm-bhyve](https://github.com/churchers/vm-bhyve)
+=> https://github.com/churchers/vm-bhyve
The following commands are executed on all three hosts `f0`, `f1`, and `f2`, where `re0` is the name of the Ethernet interface (which may need to be adjusted if your hardware is different):
@@ -100,9 +88,9 @@ network0_mac="58:9c:fc:0d:13:3f"
Whereas the `uuid` and the `network0_mac` differ on each of the 3 hosts.
-but in order to make Rocky Linux boot it (plus some other adjustments, e.g. as I am intending to run the majority of the workload in the k3s cluster running on those linux VMs, I give them beefy specs like 4 CPU cores and 14GB RAM), I modified it to:
+but in order to make Rocky Linux boot it (plus some other adjustments, e.g. as I am intending to run the majority of the workload in the k3s cluster running on those linux VMs, I give them beefy specs like 4 CPU cores and 14GB RAM), I run `doas vm configure rocky` and modified it to:
-```sh
+```
guest="linux"
loader="uefi"
uefi_vars="yes"
@@ -120,6 +108,8 @@ network0_mac="58:9c:fc:0d:13:3f"
### VM installation
+To start the installer from the downloaded ISO, I run:
+
```sh
paul@f0:~ % doas vm install rocky Rocky-9.5-x86_64-minimal.iso
Starting rocky
@@ -134,7 +124,7 @@ paul@f0:/bhyve/rocky % doas sockstat -4 | grep 5900
root bhyve 6079 8 tcp4 *:5900 *:*
```
-Port 5900 is now also open for VNC connections, so we connect to it with a VNC client and run through the installation dialogs. I'm sure this could be done unattended or more automated, but we have only 3 VMs to install, and the automation doesn't seem worth it as we are doing it only once.
+Port 5900 now also opened for VNC connections, so I connected to it with a VNC client and run through the installation dialogs. I'm sure this could be done unattended or more automated, there are only 3 VMs to install, and the automation doesn't seem worth it as we are doing it only once in a year or less often.
### Increase of the disk image
@@ -148,15 +138,36 @@ paul@f0:/bhyve/rocky % doas vm install rocky Rocky-9.5-x86_64-minimal.iso
### Connect to VPN
-For the installation, I opened the VPN client on my Fedora laptop (GNOME comes with a simple VPN client) and ran through the base installation for each of the VMs manually. I am sure this could have been automated a bit more, but there were just 3 VMs, and it wasn't worth the effort. The three VNC addresses of the VMs were: `vnc://f0:5900`, `vnc://f1:5900`, and `vnc://f0:5900`.
+For the installation, I opened the VPN client on my Fedora laptop (GNOME comes with a simple VPN client) and ran through the base installation for each of the VMs manually. Again, I am sure this could have been automated a bit more, but there were just 3 VMs, and it wasn't worth the effort. The three VNC addresses of the VMs were: `vnc://f0:5900`, `vnc://f1:5900`, and `vnc://f0:5900`.
I mostly selected the default settings (auto partitioning on the 100GB drive and a root user password). After the installation, the VMs were rebooted.
## After install
-After that, I changed the network configuration to be static here as well.
+I performed the following steps for all 3 VMs. In the following, the examples are all executed on `f0` (bzw the VM `r0` running on `f0`):
+
+### VM auto-start after host reboot
-As per previous post of this series, the 3 FreeBSD hosts were already in my `/etc/hosts` file:
+To automatically start the VM on the servers I added the following to the `rc.conf` on the FreeBSD hosts:
+
+```sh
+
+paul@f0:/bhyve/rocky % cat <<END | doas tee -a /etc/rc.conf
+vm_list="rocky"
+vm_delay="5"
+```
+
+The `vm_delay` isn't really required. It is used to wait 5 seconds before starting each VM, but as of now, there is only one VM per host. Maybe later, when there are more, this will be useful to have. After adding, there's now a `Yes` indicator in the `AUTO` column.
+
+```sh
+paul@f0:~ % doas vm list
+NAME DATASTORE LOADER CPU MEMORY VNC AUTO STATE
+rocky default uefi 4 14G 0.0.0.0:5900 Yes [1] Running (2063)
+```
+
+### Static IP configuration
+
+After that, I changed the network configuration of the VMs to be static (from DHCP) here. As per previous post of this series, the 3 FreeBSD hosts were already in my `/etc/hosts` file:
```
192.168.1.130 f0 f0.lan f0.lan.buetow.org
@@ -164,28 +175,65 @@ As per previous post of this series, the 3 FreeBSD hosts were already in my `/et
192.168.1.132 f2 f2.lan f2.lan.buetow.org
```
-For the Rocky VMs I added those:
+For the Rocky VMs I added those to the FreeBSD hosts systems as well:
```sh
-cat <<END >>/etc/hosts
+paul@f0:/bhyve/rocky % cat <<END | doas tee -a /etc/hosts
192.168.1.120 r0 r0.lan r0.lan.buetow.org
192.168.1.121 r1 r1.lan r1.lan.buetow.org
192.168.1.122 r2 r2.lan r2.lan.buetow.org
END
```
-and configured the IPs accordingly on the VMs themselves.
+and configured the IPs accordingly on the VMs themselves by opening a root shell via RDP to the VMs and entering the following commands on each of the VMs:
+
+```sh
+[root@r0 ~] % dnmcli connection modify enp0s5 ipv4.address 192.168.1.120/24
+[root@r0 ~] % dnmcli connection modify enp0s5 ipv4.gateway 192.168.1.1
+[root@r0 ~] % dnmcli connection modify enp0s5 ipv4.dns 192.168.1.1
+[root@r0 ~] % dnmcli connection modify enp0s5 ipv4.method manual
+[root@r0 ~] % dnmcli connection down enp0s5
+[root@r0 ~] % dnmcli connection up enp0s5
+[root@r0 ~] % hostnamectl set-hostname r0.lan.buetow.org
+[root@r0 ~] % cat <<END >>/etc/hosts
+192.168.1.120 r0 r0.lan r0.lan.buetow.org
+192.168.1.121 r1 r1.lan r1.lan.buetow.org
+192.168.1.122 r2 r2.lan r2.lan.buetow.org
+END
+````
+
+Whereas:
+
+* `192.168.1.120` is the IP of the VM itself (here: `r0.lan.buetow.org`)
+* `192.168.1.1` is the address of my home router, which also does DNS.
+
+### Permitting root login
+
+As these VMs arent directly reachable via SSH from the internet, I enabled `root` login by adding a line with `PermitRootLogin yes` to `/etc/sshd/sshd_config`.
+
+Once done, I rebooted the VM by running `reboot` inside of the vm to test whether everything was configured and persisted correctly.
+
+After reboot, I copied my public key from my Laptop to the 3 VMs:
+
+```sh
+% for i in 0 1 2; do ssh-copy-id root@r$i.lan.buetow.org; done
+```
+
+And then I edited the `/etc/ssh/sshd_config` file again on all 3 VMs and configured `PasswordAuthentication no`, to only allow SSH key authentication from now on.
+
+### Install latest updates
+
+```sh
+[root@r0 ~] % dnf update
+[root@r0 ~] % dreboot
+```
+
+CPU STRESS TESTER VM VS NOT VM
Other *BSD-related posts:
-[2016-04-09 Jails and ZFS with Puppet on FreeBSD](./2016-04-09-jails-and-zfs-on-freebsd-with-puppet.md)
-[2022-07-30 Let's Encrypt with OpenBSD and Rex](./2022-07-30-lets-encrypt-with-openbsd-and-rex.md)
-[2022-10-30 Installing DTail on OpenBSD](./2022-10-30-installing-dtail-on-openbsd.md)
-[2024-01-13 One reason why I love OpenBSD](./2024-01-13-one-reason-why-i-love-openbsd.md)
-[2024-04-01 KISS high-availability with OpenBSD](./2024-04-01-KISS-high-availability-with-OpenBSD.md)
-[2024-11-17 f3s: Kubernetes with FreeBSD - Part 1: Setting the stage](./2024-11-17-f3s-kubernetes-with-freebsd-part-1.md)
-[2024-12-03 f3s: Kubernetes with FreeBSD - Part 2: Hardware and base installation](./2024-12-03-f3s-kubernetes-with-freebsd-part-2.md)
+<< template::inline::index bsd
E-Mail your comments to `paul@nospam.buetow.org` :-)
-[Back to the main site](../)
+=> ../ Back to the main site
diff --git a/gemfeed/DRAFT-f3s-kubernetes-with-freebsd-part-3.md b/gemfeed/DRAFT-f3s-kubernetes-with-freebsd-part-3.md
new file mode 100644
index 00000000..55595bcb
--- /dev/null
+++ b/gemfeed/DRAFT-f3s-kubernetes-with-freebsd-part-3.md
@@ -0,0 +1,360 @@
+# f3s: Kubernetes with FreeBSD - Part 3: Protecting from power cuts
+
+This is the third blog post about my f3s series for my self-hosting demands in my home lab. f3s? The "f" stands for FreeBSD, and the "3s" stands for k3s, the Kubernetes distribution we will use on FreeBSD-based physical machines.
+
+[2024-11-17 f3s: Kubernetes with FreeBSD - Part 1: Setting the stage](./2024-11-17-f3s-kubernetes-with-freebsd-part-1.md)
+[2024-12-03 f3s: Kubernetes with FreeBSD - Part 2: Hardware and base installation](./2024-12-03-f3s-kubernetes-with-freebsd-part-2.md)
+
+[![f3s logo](./f3s-kubernetes-with-freebsd-part-1/f3slogo.png "f3s logo")](./f3s-kubernetes-with-freebsd-part-1/f3slogo.png)
+
+## Table of Contents
+
+* [⇢ f3s: Kubernetes with FreeBSD - Part 3: Protecting from power cuts](#f3s-kubernetes-with-freebsd---part-3-protecting-from-power-cuts)
+* [⇢ ⇢ Introduction](#introduction)
+* [⇢ ⇢ Changes since last time](#changes-since-last-time)
+* [⇢ ⇢ ⇢ FreeBSD upgrade from 14.1 to 14.2](#freebsd-upgrade-from-141-to-142)
+* [⇢ ⇢ ⇢ A new home (behind the TV)](#a-new-home-behind-the-tv)
+* [⇢ ⇢ The UPS hardware](#the-ups-hardware)
+* [⇢ ⇢ Configuring FreeBSD to Work with the UPS](#configuring-freebsd-to-work-with-the-ups)
+* [⇢ ⇢ ⇢ USB Device Detection](#usb-device-detection)
+* [⇢ ⇢ ⇢ `apcupsd` Installation](#apcupsd-installation)
+* [⇢ ⇢ ⇢ UPS Connectivity Test](#ups-connectivity-test)
+* [⇢ ⇢ APC Info on Partner Nodes:](#apc-info-on-partner-nodes)
+* [⇢ ⇢ ⇢ Installation on partners](#installation-on-partners)
+* [⇢ ⇢ Power outage simulation](#power-outage-simulation)
+* [⇢ ⇢ ⇢ Pulling the plug](#pulling-the-plug)
+* [⇢ ⇢ ⇢ Restoring power](#restoring-power)
+
+## Introduction
+
+In this blog post, we are setting up the UPS for the cluster. A UPS, or Uninterruptible Power Supply, safeguards my cluster from unexpected power outages and surges. It acts as a backup battery that kicks in when the electricity cuts out—especially useful in my area, where power cuts are frequent—allowing for a graceful system shutdown and preventing data loss and corruption. This is especially important since I will also store some of my data on the f3s nodes.
+
+## Changes since last time
+
+### FreeBSD upgrade from 14.1 to 14.2
+
+There has been a new release since the last blog post in this series. The upgrade from 14.1 was as easy as:
+
+```sh
+paul@f0: ~ % doas freebsd-update fetch
+paul@f0: ~ % doas freebsd-update install
+paul@f0: ~ % doas freebsd-update -r 14.2-RELEASE upgrade
+paul@f0: ~ % doas freebsd-update install
+paul@f0: ~ % doas shutdown -r now
+```
+
+And after rebooting, I ran:
+
+```sh
+paul@f0: ~ % doas freebsd-update install
+paul@f0: ~ % doas pkg update
+paul@f0: ~ % doas pkg upgrade
+paul@f0: ~ % doas shutdown -r now
+```
+
+And after another reboot, I was on 14.2:
+
+```sh
+paul@f0:~ % uname -a
+FreeBSD f0.lan.buetow.org 14.2-RELEASE FreeBSD 14.2-RELEASE
+ releng/14.2-n269506-c8918d6c7412 GENERIC amd64
+```
+
+And, of course, I ran this on all 3 nodes!
+
+### A new home (behind the TV)
+
+I've put all the infrastructure behind my TV, as plenty of space is available. The TV hides most of the setup, which drastically improved the SAF (spouse acceptance factor).
+
+[![New hardware placement arrangement](./f3s-kubernetes-with-freebsd-part-3/f3s-changes.jpg "New hardware placement arrangement")](./f3s-kubernetes-with-freebsd-part-3/f3s-changes.jpg)
+
+I got rid of the mini-switch I mentioned in the previous blog post. I have the TP-Link EAP615-Wall mounted on the wall nearby, which is my OpenWrt-powered Wi-Fi hotspot. It also has 3 Ethernet ports, to which I connected the Beelink nodes. That's the device you see at the very top.
+
+The Ethernet cables go downward through the cable boxes to the Beelink nodes. In addition to the Beelink f3s nodes, I connected the TP-Link to the UPS as well (not discussed further in this blog post, but the positive side effect is that my Wi-Fi will still work during a power loss for some time—and during a power cut, the Beelink nodes will still be able to communicate with each other).
+
+On the very left (the black box) is the UPS, with four power outlets. Three go to the Beelink nodes, and one goes to the TP-Link. A USB output is also connected to the first Beelink node, `f0`.
+
+On the very right (halfway hidden behind the TV) are the 3 Beelink nodes stacked on top of each other. The only downside (or upside?) is that my 14-month-old daughter is now chaos-testing the Beelink nodes, as the red power buttons (now reachable for her) are very attractive for her to press when passing by randomly. :-) Luckily, that will only cause graceful system shutdowns!
+
+## The UPS hardware
+
+I wanted a UPS that I could connect to via FreeBSD, and that would provide enough backup power to operate the cluster for a couple of minutes (it turned out to be around an hour, but this time will likely be shortened after future hardware upgrades, like additional drives and a backup enclosure) and to automatically initiate the shutdown of all the f3s nodes.
+
+I decided on the APC Back-UPS BX750MI model because:
+
+* Zero noise level when there is no power cut (some light noise when the battery is in operation during a power cut).
+* Cost: It is relatively affordable (not costing thousands).
+* USB connectivity: Can be connected via USB to one of the FreeBSD hosts to read the UPS status.
+* A power output of 750VA (or 410 watts), suitable for an hour of runtime for my f3s nodes (plus the Wi-Fi router).
+* Multiple power outlets: Can connect all 3 f3s nodes directly.
+* User-replaceable batteries: I can replace the batteries myself after two years or more (depending on usage).
+* Its compact design. Overall, I like how it looks.
+
+[![The APC Back-UPS BX750MI in operation.](./f3s-kubernetes-with-freebsd-part-3/apc-back-ups.jpg "The APC Back-UPS BX750MI in operation.")](./f3s-kubernetes-with-freebsd-part-3/apc-back-ups.jpg)
+
+## Configuring FreeBSD to Work with the UPS
+
+### USB Device Detection
+
+Once plugged in via USB on FreeBSD, I could see the following in the kernel messages:
+
+```sh
+paul@f0: ~ % doas dmesg | grep UPS
+ugen0.2: <American Power Conversion Back-UPS BX750MI> at usbus0
+```
+
+### `apcupsd` Installation
+
+To make use of the USB connection, the `apcupsd` package had to be installed:
+
+```sh
+paul@f0: ~ % doas install apcupsd
+```
+
+I have made the following modifications to the configuration file so that the UPS can be used via the USB interface:
+
+```sh
+paul@f0:/usr/local/etc/apcupsd % diff -u apcupsd.conf.sample apcupsd.conf
+--- apcupsd.conf.sample 2024-11-01 16:40:42.000000000 +0200
++++ apcupsd.conf 2024-12-03 10:58:24.009501000 +0200
+@@ -31,7 +31,7 @@
+ # 940-1524C, 940-0024G, 940-0095A, 940-0095B,
+ # 940-0095C, 940-0625A, M-04-02-2000
+ #
+-UPSCABLE smart
++UPSCABLE usb
+
+ # To get apcupsd to work, in addition to defining the cable
+ # above, you must also define a UPSTYPE, which corresponds to
+@@ -88,8 +88,10 @@
+ # that apcupsd binds to that particular unit
+ # (helpful if you have more than one USB UPS).
+ #
+-UPSTYPE apcsmart
+-DEVICE /dev/usv
++UPSTYPE usb
++DEVICE
+
+ # POLLTIME <int>
+ # Interval (in seconds) at which apcupsd polls the UPS for status. This
+```
+
+I left the remaining settings as the default ones; for example, the following are of main interest:
+
+```
+# If during a power failure, the remaining battery percentage
+# (as reported by the UPS) is below or equal to BATTERYLEVEL,
+# apcupsd will initiate a system shutdown.
+BATTERYLEVEL 5
+
+# If during a power failure, the remaining runtime in minutes
+# (as calculated internally by the UPS) is below or equal to MINUTES,
+# apcupsd, will initiate a system shutdown.
+MINUTES 3
+```
+
+I then enabled and started the daemon:
+
+```sh
+paul@f0:/usr/local/etc/apcupsd % doas sysrc apcupsd_enable=YES
+apcupsd_enable: -> YES
+paul@f0:/usr/local/etc/apcupsd % doas service apcupsd start
+Starting apcupsd.
+```
+
+### UPS Connectivity Test
+
+And voila, I could now access the UPS information via the `apcaccess` command; how convenient :-) (I also read through the manual page, which provides a good understanding of what else can be done with it!).
+
+```sh
+paul@f0:~ % apcaccess
+APC : 001,035,0857
+DATE : 2025-01-26 14:43:27 +0200
+HOSTNAME : f0.lan.buetow.org
+VERSION : 3.14.14 (31 May 2016) freebsd
+UPSNAME : f0.lan.buetow.org
+CABLE : USB Cable
+DRIVER : USB UPS Driver
+UPSMODE : Stand Alone
+STARTTIME: 2025-01-26 14:43:25 +0200
+MODEL : Back-UPS BX750MI
+STATUS : ONLINE
+LINEV : 230.0 Volts
+LOADPCT : 4.0 Percent
+BCHARGE : 100.0 Percent
+TIMELEFT : 65.3 Minutes
+MBATTCHG : 5 Percent
+MINTIMEL : 3 Minutes
+MAXTIME : 0 Seconds
+SENSE : Medium
+LOTRANS : 145.0 Volts
+HITRANS : 295.0 Volts
+ALARMDEL : No alarm
+BATTV : 13.6 Volts
+LASTXFER : Automatic or explicit self test
+NUMXFERS : 0
+TONBATT : 0 Seconds
+CUMONBATT: 0 Seconds
+XOFFBATT : N/A
+SELFTEST : NG
+STATFLAG : 0x05000008
+SERIALNO : 9B2414A03599
+BATTDATE : 2001-01-01
+NOMINV : 230 Volts
+NOMBATTV : 12.0 Volts
+NOMPOWER : 410 Watts
+END APC : 2025-01-26 14:44:06 +0200
+```
+
+## APC Info on Partner Nodes:
+
+So far, so good. Host `f0` would shut down itself when short on power. But what about the `f1` and `f2` nodes? They aren't connected directly to the UPS and, therefore, wouldn't know that their power is about to be cut off. For this, `apcupsd` running on the `f1` and `f2` nodes can be configured to retrieve UPS information via the network from the `apcupsd` server running on the `f0` node, which is connected directly to the APC via USB.
+
+Of course, this won't work when `f0` is down. In this case, no operational node would be connected to the UPS via USB; therefore, the current power status would not be known. However, I consider this a rare circumstance. Furthermore, in case of an `f0` system crash, sudden power outages on the two other nodes would occur at different times, making real data loss (the main concern here) effectively impossible.
+
+### Installation on partners
+
+To do this, I installed `apcupsd` via `doas pkg install apcupsd` on `f1` and `f2`, and then I could connect to it this way:
+
+```sh
+paul@f1:~ % apcaccess -h f0.lan.buetow.org | grep Percent
+LOADPCT : 12.0 Percent
+BCHARGE : 94.0 Percent
+MBATTCHG : 5 Percent
+```
+
+But I want the daemon to be configured and enabled in such a way that it connects to the master UPS node (the one with the UPS connected via USB) so that it can also initiate a system shutdown when the UPS battery reaches low levels. For that, `apcupsd` itself needs to be aware of the UPS status.
+
+On `f1` and `f2`, I changed the configuration to use `f0` (where `apcupsd` is listening) as a remote device. I also changed the `MINUTES` setting from 3 to 6 and the `BATTERYLEVEL` setting from 5 to 10 to ensure that the `f1` and `f2` nodes could still connect to the `f0` node for UPS information before `f0` decides to shut down itself. So `f1` and `f2` must shut down earlier than `f0`:
+
+```sh
+paul@f2:/usr/local/etc/apcupsd % diff -u apcupsd.conf.sample apcupsd.conf
+--- apcupsd.conf.sample 2024-11-01 16:40:42.000000000 +0200
++++ apcupsd.conf 2025-01-26 15:52:45.108469000 +0200
+@@ -31,7 +31,7 @@
+ # 940-1524C, 940-0024G, 940-0095A, 940-0095B,
+ # 940-0095C, 940-0625A, M-04-02-2000
+ #
+-UPSCABLE smart
++UPSCABLE ether
+
+ # To get apcupsd to work, in addition to defining the cable
+ # above, you must also define a UPSTYPE, which corresponds to
+@@ -52,7 +52,6 @@
+ # Network Information Server. This is used if the
+ # UPS powering your computer is connected to a
+ # different computer for monitoring.
+-#
+ # snmp hostname:port:vendor:community
+ # SNMP network link to an SNMP-enabled UPS device.
+ # Hostname is the ip address or hostname of the UPS
+@@ -88,8 +87,8 @@
+ # that apcupsd binds to that particular unit
+ # (helpful if you have more than one USB UPS).
+ #
+-UPSTYPE apcsmart
+-DEVICE /dev/usv
++UPSTYPE net
++DEVICE f0.lan.buetow.org:3551
+
+ # POLLTIME <int>
+ # Interval (in seconds) at which apcupsd polls the UPS for status. This
+@@ -147,12 +146,12 @@
+ # If during a power failure, the remaining battery percentage
+ # (as reported by the UPS) is below or equal to BATTERYLEVEL,
+ # apcupsd will initiate a system shutdown.
+-BATTERYLEVEL 5
++BATTERYLEVEL 10
+
+ # If during a power failure, the remaining runtime in minutes
+ # (as calculated internally by the UPS) is below or equal to MINUTES,
+ # apcupsd, will initiate a system shutdown.
+-MINUTES 3
++MINUTES 6
+
+ # If during a power failure, the UPS has run on batteries for TIMEOUT
+ # many seconds or longer, apcupsd will initiate a system shutdown.
+
+```
+So I also ran the following commands on `f1` and `f2`:
+
+```sh
+paul@f1:/usr/local/etc/apcupsd % doas sysrc apcupsd_enable=YES
+apcupsd_enable: -> YES
+paul@f1:/usr/local/etc/apcupsd % doas service apcupsd start
+Starting apcupsd.
+```
+
+And then I was able to connect to localhost via the `apcaccess` command:
+
+```sh
+paul@f1:~ % doas apcaccess | grep Percent
+LOADPCT : 5.0 Percent
+BCHARGE : 95.0 Percent
+MBATTCHG : 5 Percent
+```
+
+## Power outage simulation
+
+### Pulling the plug
+
+I simulated a power outage by removing the power input from the APC. Immediately, the following message appeared on all the nodes:
+
+````
+Broadcast Message from root@f0.lan.buetow.org
+ (no tty) at 15:03 EET...
+
+Power failure. Running on UPS batteries.
+```
+
+I ran the following command to confirm the available battery time:
+
+```sh
+paul@f0:/usr/local/etc/apcupsd % apcaccess -p TIMELEFT
+63.9 Minutes
+```
+
+And after almost 60 minutes (`f1` and `f2` a bit earlier, `f0` a bit later due to the different `BATTERYLEVEL` and `MINUTES` settings outlined earlier), the following broadcast was sent out:
+
+```
+Broadcast Message from root@f0.lan.buetow.org
+ (no tty) at 15:08 EET...
+
+ *** FINAL System shutdown message from paul@f1.lan.buetow.org ***
+
+System going down IMMEDIATELY
+
+apcupsd initiated shutdown
+```
+
+And all the nodes shut down safely before the UPS ran out of battery!
+
+### Restoring power
+
+After restoring power, I checked the logs in `/var/log/daemon.log` and found the following on all 3 nodes:
+
+```
+Jan 26 17:36:24 f2 apcupsd[2159]: Power failure.
+Jan 26 17:36:30 f2 apcupsd[2159]: Running on UPS batteries.
+Jan 26 17:36:30 f2 apcupsd[2159]: Battery charge below low limit.
+Jan 26 17:36:30 f2 apcupsd[2159]: Initiating system shutdown!
+Jan 26 17:36:30 f2 apcupsd[2159]: User logins prohibited
+Jan 26 17:36:32 f2 apcupsd[2159]: apcupsd exiting, signal 15
+Jan 26 17:36:32 f2 apcupsd[2159]: apcupsd shutdown succeeded
+```
+
+All good :-)
+
+Other BSD related posts are:
+
+[2016-04-09 Jails and ZFS with Puppet on FreeBSD](./2016-04-09-jails-and-zfs-on-freebsd-with-puppet.md)
+[2022-07-30 Let's Encrypt with OpenBSD and Rex](./2022-07-30-lets-encrypt-with-openbsd-and-rex.md)
+[2022-10-30 Installing DTail on OpenBSD](./2022-10-30-installing-dtail-on-openbsd.md)
+[2024-01-13 One reason why I love OpenBSD](./2024-01-13-one-reason-why-i-love-openbsd.md)
+[2024-04-01 KISS high-availability with OpenBSD](./2024-04-01-KISS-high-availability-with-OpenBSD.md)
+[2024-11-17 f3s: Kubernetes with FreeBSD - Part 1: Setting the stage](./2024-11-17-f3s-kubernetes-with-freebsd-part-1.md)
+[2024-12-03 f3s: Kubernetes with FreeBSD - Part 2: Hardware and base installation](./2024-12-03-f3s-kubernetes-with-freebsd-part-2.md)
+
+E-Mail your comments to `paul@nospam.buetow.org` :-)
+
+[Back to the main site](../)
diff --git a/gemfeed/f3s-kubernetes-with-freebsd-part-3/apc-back-ups.jpg b/gemfeed/f3s-kubernetes-with-freebsd-part-3/apc-back-ups.jpg
new file mode 100644
index 00000000..15b1ca78
--- /dev/null
+++ b/gemfeed/f3s-kubernetes-with-freebsd-part-3/apc-back-ups.jpg
Binary files differ
diff --git a/gemfeed/f3s-kubernetes-with-freebsd-part-3/f3s-changes.jpg b/gemfeed/f3s-kubernetes-with-freebsd-part-3/f3s-changes.jpg
new file mode 100644
index 00000000..5752f2fc
--- /dev/null
+++ b/gemfeed/f3s-kubernetes-with-freebsd-part-3/f3s-changes.jpg
Binary files differ