summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-01-14 23:47:38 +0200
committerPaul Buetow <paul@buetow.org>2025-01-14 23:47:38 +0200
commitdf3f7d0ff779c353422e8b6d76a64ba5ea3d36bd (patch)
treeefb1a6878f994dfe9aeece932f32515aa20dee51
parent71875e75538b21cfdf938711eebefd4e635fe56a (diff)
more on the draft
-rw-r--r--gemfeed/2024-12-03-f3s-kubernetes-with-freebsd-part-2.gmi.tpl3
-rw-r--r--gemfeed/DRAFT-f3s-kubernetes-with-freebsd-bhyve.gmi.tpl88
2 files changed, 75 insertions, 16 deletions
diff --git a/gemfeed/2024-12-03-f3s-kubernetes-with-freebsd-part-2.gmi.tpl b/gemfeed/2024-12-03-f3s-kubernetes-with-freebsd-part-2.gmi.tpl
index ed410af7..80a08ad1 100644
--- a/gemfeed/2024-12-03-f3s-kubernetes-with-freebsd-part-2.gmi.tpl
+++ b/gemfeed/2024-12-03-f3s-kubernetes-with-freebsd-part-2.gmi.tpl
@@ -110,6 +110,7 @@ root@f0:~ # freebsd-update reboot
```
I also added the following entries for the three FreeBSD boxes to the `/etc/hosts` file:
+
```sh
root@f0:~ # cat <<END >>/etc/hosts
192.168.1.130 f0 f0.lan f0.lan.buetow.org
@@ -118,6 +119,8 @@ root@f0:~ # cat <<END >>/etc/hosts
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.
+
## After install
After that, I installed the following additional packages:
diff --git a/gemfeed/DRAFT-f3s-kubernetes-with-freebsd-bhyve.gmi.tpl b/gemfeed/DRAFT-f3s-kubernetes-with-freebsd-bhyve.gmi.tpl
index 66184ca7..1d63d42e 100644
--- a/gemfeed/DRAFT-f3s-kubernetes-with-freebsd-bhyve.gmi.tpl
+++ b/gemfeed/DRAFT-f3s-kubernetes-with-freebsd-bhyve.gmi.tpl
@@ -12,7 +12,7 @@ This is the third blog post about my f3s series for my self-hosting demands in m
In this blog post, we are going to install the Bhyve hypervisor.
-The FreeBSD Bhyve hypervisor is a lightweight, modern hypervisor that enables virtualization on FreeBSD systems. Bhyve's strengths include its minimal overhead, which allows it to achieve near-native performance for virtual machines. It is designed to be efficient and lightweight, leveraging the capabilities of the FreeBSD operating system for performance and network management.
+The FreeBSD Bhyve hypervisor is a lightweight, modern hypervisor that enables virtualization on FreeBSD systems. Bhyve's strengths include its minimal overhead, which allows it to achieve near-native performance for virtual machines. It is designed to be efficient and lightweight, leveraging the capabilities of the FreeBSD operating system for performance and network management.
Bhyve supports running a variety of guest operating systems, including FreeBSD, Linux, and Windows, on hardware platforms that support hardware virtualization extensions (such as Intel VT-x or AMD-V). In our case, we are going to virtualize Rocky Linux, which later on in this series will be used to run k3s.
@@ -25,35 +25,35 @@ For the management of the Bhyve VMs, we are using `vm-bhyve`, a tool not part of
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):
```sh
-paul@f2:~ % doas pkg install vm-bhyve bhyve-firmware
-paul@f2:~ % doas sysrc vm_enable=YES
+paul@f0:~ % doas pkg install vm-bhyve bhyve-firmware
+paul@f0:~ % doas sysrc vm_enable=YES
vm_enable: -> YES
-paul@f2:~ % doas sysrc vm_dir=zfs:zroot/bhyve
+paul@f0:~ % doas sysrc vm_dir=zfs:zroot/bhyve
vm_dir: -> zfs:zroot/bhyve
-paul@f2:~ % doas zfs create zroot/bhyve
-paul@f2:~ % doas vm init
-paul@f2:~ % doas vm create public
-paul@f2:~ % doas vm switch add public re0
+paul@f0:~ % doas zfs create zroot/bhyve
+paul@f0:~ % doas vm init
+paul@f0:~ % doas vm switch create public
+paul@f0:~ % doas vm switch add public re0
```
Bhyve stores all it's data in the `/bhyve` of the `zroot` ZFS pool:
```sh
-paul@f2:~ % zfs list | grep bhyve
+paul@f0:~ % zfs list | grep bhyve
zroot/bhyve 1.74M 453G 1.74M /zroot/bhyve
```
For convenience, we also create this symlink:
```sh
-paul@f2:~ % doas ln -s /zroot/bhyve/ /bhyve
+paul@f0:~ % doas ln -s /zroot/bhyve/ /bhyve
```
Now, Bhyve is ready to rumble, but no VMs are there yet:
```sh
-paul@f2:~ % doas vm list
+paul@f0:~ % doas vm list
NAME DATASTORE LOADER CPU MEMORY VNC AUTO STATE
```
@@ -64,17 +64,17 @@ NAME DATASTORE LOADER CPU MEMORY VNC AUTO STATE
We're going to install the Rocky Linux from the latest minimal iso:
```sh
-paul@f2:~ % doas vm iso \
+paul@f0:~ % doas vm iso \
https://download.rockylinux.org/pub/rocky/9/isos/x86_64/Rocky-9.5-x86_64-minimal.iso
/zroot/bhyve/.iso/Rocky-9.5-x86_64-minimal.iso 1808 MB 4780 kBps 06m28s
-paul@f2:/bhyve % doas vm create rocky
+paul@f0:/bhyve % doas vm create rocky
```
### VM configuration
The default configuration looks like this now:
```sh
-paul@f2:/bhyve/rocky % cat rocky.conf
+paul@f0:/bhyve/rocky % cat rocky.conf
loader="bhyveload"
cpu=1
memory=256M
@@ -86,12 +86,30 @@ uuid="1c4655ac-c828-11ef-a920-e8ff1ed71ca0"
network0_mac="58:9c:fc:0d:13:3f"
```
-but in order to make Rocky Linux boot, it...
+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:
+
+```sh
+guest="linux"
+loader="uefi"
+uefi_vars="yes"
+cpu=4
+memory=14G
+network0_type="virtio-net"
+network0_switch="public"
+disk0_type="virtio-blk"
+disk0_name="disk0.img"
+graphics="yes"
+graphics_vga=io
+uuid="1c45400b-c828-11ef-8871-e8ff1ed71cac"
+network0_mac="58:9c:fc:0d:13:3f"
+```
### VM installation
```sh
-paul@f2:~ % doas vm install rocky Rocky-9.5-x86_64-minimal.iso
+paul@f0:~ % doas vm install rocky Rocky-9.5-x86_64-minimal.iso
Starting rocky
* found guest in /zroot/bhyve/rocky
* booting...
@@ -106,6 +124,44 @@ 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.
+### Increase of the disk image
+
+By default the VMs disk image is only 20G, which is a bit small for my purposes, so I stopped the VMs again and run `truncate` on the image file to enlarge them to 100G, and re-started the installation:
+
+```sh
+paul@f0:/bhyve/rocky % doas vm stop rocky
+paul@f0:/bhyve/rocky % doas truncate -s 100G disk0.img
+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`.
+
+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.
+
+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
+192.168.1.131 f1 f1.lan f1.lan.buetow.org
+192.168.1.132 f2 f2.lan f2.lan.buetow.org
+```
+
+For the Rocky VMs I added those:
+
+```sh
+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
+```
+and configured the IPs accordingly on the VMs themselves.
Other *BSD-related posts: