Graham Stevens
⟵ Home

M1 MacBook Pro as a k3s Node with Asahi Linux

· 4 min read

Background

At home, I run a small 4 node k3s cluster on Dell Wyse 5070, primarily for the experience but also just for the fun of it. It houses all sorts of containers, but happily handles almost everything I throw at it, including Home Assistant, an MQTT instance, Predbat, Smokeping etc. etc.

This little stack of 4 Dell thin clients sits on the corner of my desk, each being powered via a single USB power supply - this means it only takes up a single power socket under the desk for neatness. Each node is also connected to a single Ubiquiti 5 port POE switch (USW-Flex), which again means no plug sockets being used up under the desk (but of course requires a POE switch to power it elsewhere…). Lovely and neat! Each node has two 8GB sticks of RAM, and I’ve replaced the M.2 WiFi cards with M.2 to NVME adapters to all me to expand the local storage.

Dusting off the M1 Macbook Pro

Whilst doing a spot of tidying, I was reminded that I had an old work M1 Macbook Pro sat around gathering dust. Knowing that these machines are well known for only sipping a few watts whilst idle, I wondered if it was feasible to turn this into an additional node (and maybe even replace a few 5070s…).

First step was to get Asahi installed, which was simpler than I was expecting - copy a curl | sh command from their homepage into my terminal of choice, and follow the on-screen instructions. It did it’s thing, and I’d say in 30 minutes or so, I was booted into Asahi Linux on my M1. Pretty simple, and very easy.

UK Keyboard

A minor issue, but it didn’t quite have the correct keymap for my UK Macbook Pro keyboard, so a little trial and error suggested localectl set-keymap gb-mac way the forward.

Insomnia Mode

So, to make a good compute node, I ideally wanted the machine to stay on 24/7 and be as unobtrusive as possible in my room. This of course meant that I needed the machine to stay online and awake whilst I had the lid closed. Again, a few minutes of tinkering produced:

sudo mkdir -p /etc/systemd/logind.conf.d
sudo tee /etc/systemd/logind.conf.d/99-lid-ignore.conf <<EOF
[Login]
HandleLidSwitch=ignore
HandleLidSwitchExternalPower=ignore
HandleLidSwitchDocked=ignore
EOF
sudo systemctl restart systemd-logind

And there we go, lid closed, machine tucked away into a corner still silently whirring away.

k3s

Now for the fun part - actually installing k3s! For this, I actually use k3sup to simplify the process.

Firstly, I ssh’d into the machine and dropped my public key into ~/.ssh/authorized_keys to save throwing passwords around, and then also made sudo passwordless for my user, as per the instructions:

# sudo visudo

# Then add to the bottom of the file
# replace "alex" with your username i.e. "ubuntu"
alex ALL=(ALL) NOPASSWD: ALL

Now for the fun part! k3sup join --ip <m1-ip-address> --server-ip <controller-ip> --user <m1-username> and a few seconds later, node-asahi was up and running. That’s it, nothing to troubleshoot or fix, it just worked.

The final step, which is arguably specific to my setup, but might help someone who happens to stumble across this, is getting Longhorn happy. Again, this was far easier than I was expecting, and only failed in the first place because I forgot to install the necessary dependencies on node-asahi. Installing open-iscsi and enabling the iscsid service was the solution, as well as including nfs-utils for my own setup.

🎉

Thoughts

Normally these sorts of silly ideas end up as a rabbit hole upon rabbit hole of troubleshooting and iffy-looking fixes, but honestly in this case it was surprisingly smoothly. Installing Asahi was a piece of cake, and k3sup was easier still. I think the longest part of this whole process was working out the correct keymap to get my £ key working…