NetBSD as a Kubernetes Pod

I had to do it. So here’s how to run a NetBSD micro-vm as… a Kubernetes pod. First thing is to modify the start script from the previous article in order to add Docker-style networking, i.e. port forwarding from the host to the micro-vm. This is done using the hostfwd flag in qemu’s -netdev parameter #!/bin/sh kernel=$1 img=${2:-"root.img"} [ -n "$3" ] && drive2="-drive file=${3},if=virtio" qemu-system-x86_64 -enable-kvm -m 256 \ -kernel $kernel -append "console=com root=ld0a" \ -serial mon:stdio -display none \ -drive file=${img},if=virtio $drive2 \ -netdev user,id=net0,hostfwd=tcp::8080-:80 -device virtio-net,netdev=net0 In the previous experience we mapped the kernel and the root image from the host using Docker’s -v parameter, and while it’s possible to map files from the host using a Kubernetes volume, we will bundle NetBSD these files into the Docker image to make things easier.

NetBSD as a Docker Container

I have this little toy project for quite a while now, and I have this idea of handling a fleet of NetBSD micro-vms with Kubernetes since I started my new job in which I am caring a k8s cluster. I came to realize that starting a smolBSD micro-vm with Docker was not so difficult after all. Using mksmolnb’s I came up with this very simple Dockerfile: FROM alpine:latest RUN apk add --quiet --no-cache qemu-system-x86_64 iproute2 bridge-utils COPY startnb.


Ok this is possibly the easiest thing on earth but I didn’t see any clear documentation on the topic apart from a simple text file which actually helped. The server runs into a FreeBSD jail, I won’t cover this part as there are plenty of good documentation on this matter already. The first step is obviously to install nsd, for example using pkg: # pkg install nsd My master DNS server runs BIND so there’s no specifics regarding nsd, here’s the most basic configuration the slave needs:

Generate An Ansible Report By Updating A Variable

At $(DAYJOB) I was asked to generate some kind of daily report, and I thought ansible would do the job; we basically want to have a couple of key metrics like load average, memory, disk… you see the deal. The result is to be send to MatterMost using mattermost’s ansible module. It took me way too much time to understand how to update a single variable in order to build a mardown table that would be sent as a single request to the MatterMost server, until neith_speed told me to use hostvars in order to have access to the data gathered by the play for every host.

Using Kibana API as an Elasticsearch Proxy

While searching for an elasticsearch tail -f, I stumble upon this nice piece of software that does exactly that. Reading the configuration file I noticed the server_kibana-proxy section and wondered if that meant that elasticsearch could be queried via kibana, and it turns out that yes, you don’t have to expose ES port (:9200), you can use kibana’s API instead, in particular the console API to be able to query ES directly.

Build a Single in Tree Linux Kernel Module (Debian & Clones)

How misleading and complicated this task should be that I’m writing such an article in 2022? Anyway, if you struggle compiling a simple, standalone Linux kernel module on Debian, Ubuntu, Mint and the like, here’s the recipe: Fetch linux-source-<version> and linux-headers-<version> $ sudo apt install linux-source-5.4.0 linux-headers-$(uname -r) Do not use apt-get source linux-source-<version>, only pain will you find. Untar the fetched archive where you’d like $ tar jxvf /usr/src/linux-source-5.4.0.tar.bz2 Copy your current kernel configuration $ cd linux-source-5.

Migrating A ZPool To A Smaller Disk

A week ago, I’ve migrated my gateway to a standalone machine running FreeBSD 13.1. The whole process was certainly flawless and soon enough it was forwarding packets to and from my network. Quite happy with the result, I didn’t expect it to crash less than 2 days after its first production hour. At first I thought it could have been the temperature, the graphic card, the memory… until it crashed again a couple of days after and I saw this:

An Innocent Mount Issue

I work as a freelance contractor for about a year now, I quit a 10+ years regular CTO job to give into more technical subjects, troubleshoot, code, build infrastructures, A-Team style, I help companies with complex matters that might require experience and rigorousness. One of my last missions was really, really fun to deal with. A rather big company handling scientific, secret-level data, had an issue with their storage system.

No AP After Flashing Tasmota to Sonoff Mini

I’m in the process of automating pretty much all I can in my house, and one piece of well known IOT hardware is eWelink’s Sonoff mini, which has the good taste of being flashable when set in DYI mode. This has multiple benefits, one of them is not to rely on a Chinese cloud to handle my house’s lights. There are plenty of tutorials on how to achieve this, it is not the aim of this short article.

Postfix to GMail Catchall (updated… again)

The other day, my wife asked me if I could just redirect all mails going to her own domain to her GMail account. “Easy task”, foolish past-me thought, not knowing the standards you have to meet to actually forward a mail from somwhere to GMail… I naively searched for a simple bouncing method and postfix’s virtual tables seemed perfectly fit for the task (from man virtual): The main applications of virtual aliasing are: o To redirect mail for one address to one or more addresses.