Turn three old laptops into a Kubernetes cluster
The same system that runs most of the cloud, on the laptops in your drawer. Join them into one k3s cluster, serve an app with a real hostname and storage copied across three machines, then pull the power on one laptop and watch your app move itself. Each battery is a built-in UPS, and the whole thing runs for about the cost of a light bulb.
- Uptime Kuma running on the cluster, plus remote access from anywhere over Tailscale
- A kit: node prep script, ready-to-apply manifests, a kubectl cheatsheet and a parts and power calculator
- Three laptops from roughly the last ten years, 64-bit, ideally 8GB RAM and an SSD each (the main one needs at least 2 cores and 2GB). Two works; three is what makes storage survive a failure
- A USB stick (8GB+) for the Ubuntu installer, and Ethernet to your router for each laptop (USB adapters around £15)
- Container basics: Docker without fear. Linux and SSH comfort: Terminal survival kit
- Back up anything you want from the laptops first: the install wipes them
Plan the cluster
Know what each laptop does, what Kubernetes gives you, and what it costs to run.
What you're buildingKubernetes treats several computers as one. You tell it "run three copies of this app, give it 2GB of storage, serve it at this hostname", and it decides which laptop runs what. When a laptop dies, it notices within a minute or so and starts the work again elsewhere. k3s ↗ is a complete, certified Kubernetes in a single small binary, built for exactly this kind of hardware. It ships with Traefik (routes web traffic by hostname), ServiceLB (gives services a real IP on your network), local-path storage, CoreDNS and metrics-server.
RolesOne laptop is the server (runs the control plane and the cluster database, and still runs apps too). The others are agents (they just run apps). Give the server role to the laptop with the most RAM and an SSD. k3s's minimums are 2 cores and 2GB for a server, 1 core and 512MB for an agent; Longhorn storage (step 5) recommends 4 cores and 4GB per node and SSDs.
k3s-1: server, e.g. a 2017 ThinkPad with 16GB and an SSDk3s-2,k3s-3: agents, anything 64-bit with 8GB
NetworkWired beats Wi-Fi every time for a cluster: Wi-Fi drops cause nodes to flap between ready and not ready. Put the laptops on a cheap gigabit switch next to your router. In your router, give each laptop a DHCP reservation so its IP never changes. This mission uses
192.168.1.50,.51and.52: use yours.PowerAn old laptop idles at roughly 6 to 15 watts with the screen off. At 10W each, three laptops use about 263kWh a year, about £69 at the Ofgem price cap average of 26.32p per kWh ↗. Measure yours with a smart plug and put it in the parts and power calculator.
CarefulOld laptop batteries can swell. If a laptop's case bulges, the trackpad lifts or the battery looks puffy, remove the battery (or retire the laptop) before running it 24/7. Run them on a hard surface with the vents clear, not stacked on top of each other.Download the kit:
prep-node.sh,whoami.yaml,uptime-kuma.yaml, the kubectl cheatsheet and the parts and power calculator.