summaryrefslogtreecommitdiff
path: root/gemfeed
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-01-04 15:51:18 +0200
committerPaul Buetow <paul@buetow.org>2025-01-04 15:51:18 +0200
commit26fa9e16024a891c8b0c6b46480490ebecb2c173 (patch)
tree0451d8ac1b85433f070a2580b917e7b5505a262e /gemfeed
parent18b32f7cd29df2f987e091e12674c68243dd5e20 (diff)
Update content for gemtext
Diffstat (limited to 'gemfeed')
-rw-r--r--gemfeed/DRAFT-f3s-kubernetes-with-freebsd-bhyve.gmi132
1 files changed, 132 insertions, 0 deletions
diff --git a/gemfeed/DRAFT-f3s-kubernetes-with-freebsd-bhyve.gmi b/gemfeed/DRAFT-f3s-kubernetes-with-freebsd-bhyve.gmi
new file mode 100644
index 00000000..bdd48db9
--- /dev/null
+++ b/gemfeed/DRAFT-f3s-kubernetes-with-freebsd-bhyve.gmi
@@ -0,0 +1,132 @@
+# f3s: Kubernetes with FreeBSD - Rocky Linux Bhyve VMs - Part 3
+
+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.gmi 2024-11-17 f3s: Kubernetes with FreeBSD - Part 1: Setting the stage
+=> ./2024-12-03-f3s-kubernetes-with-freebsd-part-2.gmi 2024-12-03 f3s: Kubernetes with FreeBSD - Part 2: Hardware and base installation
+
+=> ./f3s-kubernetes-with-frhyveeebsd-part-1/f3slogo.png f3s logo
+
+## Table of Contents
+
+* ⇢ f3s: Kubernetes with FreeBSD - Rocky Linux Bhyve VMs - Part 3
+* ⇢ ⇢ Introduction
+* ⇢ ⇢ Basic Bhyve setup
+* ⇢ ⇢ Rocky Linux VMs
+* ⇢ ⇢ ⇢ ISO download
+* ⇢ ⇢ ⇢ VM configuration
+* ⇢ ⇢ ⇢ VM installation
+
+## Introduction
+
+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.
+
+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.
+
+## Basic Bhyve setup
+
+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
+
+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
+vm_enable: -> YES
+paul@f2:~ % 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
+```
+
+Bhyve stores all it's data in the `/bhyve` of the `zroot` ZFS pool:
+
+```sh
+paul@f2:~ % 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
+
+```
+
+Now, Bhyve is ready to rumble, but no VMs are there yet:
+
+```sh
+paul@f2:~ % doas vm list
+NAME DATASTORE LOADER CPU MEMORY VNC AUTO STATE
+```
+
+## Rocky Linux VMs
+
+### ISO download
+
+We're going to install the Rocky Linux from the latest minimal iso:
+
+```sh
+paul@f2:~ % 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
+```
+### VM configuration
+
+The default configuration looks like this now:
+
+```sh
+paul@f2:/bhyve/rocky % cat rocky.conf
+loader="bhyveload"
+cpu=1
+memory=256M
+network0_type="virtio-net"
+network0_switch="public"
+disk0_type="virtio-blk"
+disk0_name="disk0.img"
+uuid="1c4655ac-c828-11ef-a920-e8ff1ed71ca0"
+network0_mac="58:9c:fc:0d:13:3f"
+```
+
+but in order to make Rocky Linux boot, it...
+
+### VM installation
+
+```sh
+paul@f2:~ % doas vm install rocky Rocky-9.5-x86_64-minimal.iso
+Starting rocky
+ * found guest in /zroot/bhyve/rocky
+ * booting...
+
+paul@f0:/bhyve/rocky % doas vm list
+NAME DATASTORE LOADER CPU MEMORY VNC AUTO STATE
+rocky default uefi 4 14G 0.0.0.0:5900 No Locked (f0.lan.buetow.org)
+
+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.
+
+
+
+Other *BSD-related posts:
+
+=> ./2016-04-09-jails-and-zfs-on-freebsd-with-puppet.gmi 2016-04-09 Jails and ZFS with Puppet on FreeBSD
+=> ./2022-07-30-lets-encrypt-with-openbsd-and-rex.gmi 2022-07-30 Let's Encrypt with OpenBSD and Rex
+=> ./2022-10-30-installing-dtail-on-openbsd.gmi 2022-10-30 Installing DTail on OpenBSD
+=> ./2024-01-13-one-reason-why-i-love-openbsd.gmi 2024-01-13 One reason why I love OpenBSD
+=> ./2024-04-01-KISS-high-availability-with-OpenBSD.gmi 2024-04-01 KISS high-availability with OpenBSD
+=> ./2024-11-17-f3s-kubernetes-with-freebsd-part-1.gmi 2024-11-17 f3s: Kubernetes with FreeBSD - Part 1: Setting the stage
+=> ./2024-12-03-f3s-kubernetes-with-freebsd-part-2.gmi 2024-12-03 f3s: Kubernetes with FreeBSD - Part 2: Hardware and base installation
+
+E-Mail your comments to `paul@nospam.buetow.org` :-)
+
+=> ../ Back to the main site