Skip to content
Mementropy
Lab NotesHomelab notebookField note

Building a management cluster on a closed-lid laptop

I turned a ThinkPad X1 Yoga into a lid-closed single-node K3s management server, including two mistakes and one false alarm.

By Ryan Hammang

On October 16 I turned my ThinkPad X1 Yoga Gen 7 into a single-node K3s server that sits on a shelf with its lid closed. It’s the management cluster for my homelab. It will run Gitea, Infisical, Kaneo and Argo CD, kept apart from the workload cluster on the Dell. This post covers the day it went from a laptop to a server, including two mistakes and one false alarm.

An AI agent did most of the typing while I directed it and checked the results.

I installed Ubuntu Server 26.04.1 on bare metal. Two choices up front:

  • No disk encryption. A headless server has to boot by itself after a power cut, and an encryption passphrase prompt would stop it at boot with nobody there to type. That’s a real trade-off, and I made it on purpose.
  • A separate admin account for server work, apart from my everyday account.

The X1 has no built-in Ethernet port, so it uses a USB Ethernet adapter for its wired connection.

Swapping the USB adapter broke the network

Section titled “Swapping the USB adapter broke the network”

I started with a temporary USB adapter and later swapped in the permanent one. That broke networking.

Ubuntu names USB network interfaces after the adapter’s MAC address: enx followed by the MAC. A new adapter means a new interface name. The netplan file the installer wrote was pinned to the old name, so it no longer matched anything. I deleted it. After that, boot hung for a couple of minutes on systemd-networkd-wait-online, which waits for configured interfaces that never show up.

The fix was a generic netplan file that matches any wired interface and doesn’t block boot:

network:
version: 2
renderer: networkd
ethernets:
wired:
match:
name: "en*"
dhcp4: true
optional: true

I applied it with netplan try, which rolls back by itself if you lose the connection. The router’s address reservation was tied to the old adapter’s MAC, so I moved it to the new one. One more thing to remember for next time: K3s is told which interface to use for pod traffic, by name, so another adapter swap means updating that setting too.

A laptop suspends when the lid closes. I’d worked out the answer for a different laptop back in September. Configure it in the operating system, not with an app that keeps the machine awake. This time I used a drop-in file instead of editing the main logind config, so package upgrades won’t overwrite it:

/etc/systemd/logind.conf.d/70-shelf-server.conf
[Login]
HandleLidSwitch=suspend
HandleLidSwitchExternalPower=ignore
HandleLidSwitchDocked=ignore
IdleAction=ignore

On AC power it ignores the lid. On battery it still suspends, which protects the battery if the charger is ever unplugged. After a reboot I closed the lid for a couple of minutes, then left it idle longer. SSH stayed up and uptime kept counting.

Before putting load on it, I checked temperatures with lm-sensors. Idle with the lid closed: CPU package 43°C, NVMe 38°C, fan at 0 RPM. Fine.

The same output had a line for a USB-C power source reading 5.00 V and 3.00 A. The agent read that as the charger delivering only about 15 W and told me to fix the charger. I was using the original charger, and something didn’t add up. So I asked whether it was confusing the USB Ethernet adapter for the charger, and that was the mix-up. That sensor describes a USB-C port’s power role, and that port was powering the adapter.

The reliable check is the power-supply state files:

Terminal window
cat /sys/class/power_supply/AC/online /sys/class/power_supply/BAT0/status

That returned 1 and Not charging. AC was online. “Not charging” while plugged in means the battery is full or Lenovo’s charge limit is holding it, which is what I want on a machine that’s always plugged in. Knowing what’s plugged into which port beat reading a sensor label.

I turned swap off and removed the 8 GB swap file, since Kubernetes expects swap to be off. I also checked that my network routes didn’t overlap the address ranges K3s uses for pods and services. They didn’t.

The whole point of moving to Kubernetes was declarative configuration, so the K3s settings went in a file instead of a long command line. The file in /etc/rancher/k3s/config.yaml sets four things: the node’s LAN address, the wired interface for pod traffic, a kubeconfig readable only by root, and encryption of Secrets at rest.

I downloaded the install script, read it before running it, and made sure no leftover join variables could turn this server into a member of some other cluster. It installed K3s v1.36.5+k3s1. The node came up Ready, with CoreDNS, Traefik, metrics-server and the local-path storage provisioner running, and secrets encryption reported as enabled.

To prove the path from Deployment to Service to Traefik Ingress, I deployed traefik/whoami, which echoes back the request it received. I did it imperatively first, with kubectl create deployment, kubectl expose and kubectl create ingress. A curl to the laptop’s hostname came back through Traefik with the pod’s details.

Afterward I wrote the same three objects as a manifest, hello.yaml, which is the form I actually want to keep in Git.

Then I rebooted to check that everything came back without help. Before I looked, I predicted the pod would have the same name and IP “since we explicitly defined it.” I was half right, for the wrong reason. The name was the same only because the reboot restarted the container inside the existing pod. The IP changed. We had never defined either one. The Service is the stable address. Pods come and go.

The last check was heat. I ran 14 yes processes for two minutes with the lid closed. The CPU package reached 69°C with the fan at 6,338 RPM, well under the chip’s 100°C limit.

There’s a catch in that test. The i7-1280P has 14 cores but 20 threads, so 14 processes didn’t load every thread. A true full-load test runs one per thread with $(nproc), ideally for longer. I’d like to re-run it that way.

The Kubernetes part was the easy part. The day was mostly about the laptop: interface names, sleep settings, sensors and heat. And the false alarm is the one I’ll remember. Check the direct source before believing an interpretation, whether that interpretation comes from me or from an agent.

The next step is a follow-on about the disk, in Leaving most of the X1 disk unallocated.

Has anyone run a laptop like this as a server for a year or more? I’d like to know how the battery held up.