Simplifying my homelab
My previous homelab setup was feeling overly engineered and overly complicated. I had setup k3s as I had thought I would have a multi-node cluster, but ended up only having a single node. To manage deployments, I used ArgoCD. And I used metallb to allow for individual local IPs per service. This setup worked, but I feared if my single node failed, I would not be able to set it back up again. I was drawn to learning new and shiny technologies.
I decided to refactor how I approached my homelab, this time with a focus on simplicity and ease of setup. I wanted to be confident I could set up a new node in case of failure.
For this version of my homelab, I decided to forego k3s and simply use Docker compose to set up my services. There’s a network driver for Docker macvlan that allows you to declare a static IPV4 address for a container.
Now, to set up the homelab, I just need to provision a Raspberry Pi with Ubuntu, install Docker, copy over my docker-compose.yaml file, and run docker compose up.
Here is what my compose file looks like:
services:
pihole:
container_name: pihole
# https://hub.docker.com/r/jacklul/pihole/tags
image: jacklul/pihole:latest
restart: always
networks:
macvlan_net:
ipv4_address: 192.168.0.20
ports:
- "80:80"
- "53:53/tcp"
- "53:53/udp"
- "67:67/udp"
- "443:443/tcp"
volumes:
...
jellyfin:
container_name: jellyfin
image: jellyfin/jellyfin
restart: always
ports:
- "8096:8096"
- "8920:8920" # HTTPS port
volumes:
...
networks:
macvlan_net:
ipv4_address: 192.168.0.21
uptime-kuma:
container_name: uptime-kuma
image: louislam/uptime-kuma:latest
restart: always
ports:
- "3001:3001"
volumes:
...
networks:
macvlan_net:
ipv4_address: 192.168.0.25
networks:
macvlan_net:
driver: macvlan
driver_opts:
parent: eth0
ipam:
config:
- subnet: 192.168.0.0/24
gateway: 192.168.0.1
Some notes:
First, always set containers to restart: always to ensure that the container starts after reboots of the host.
Second, the host cannot connect to the services by their static IPs created by the macvlan network. The times where this becomes an issue is if the host is trying to resolve DNS from the pihole’s container. To resolve this pin the host’s DNS resolver to 1.1.1.1 (or whatever external resolve you want to use):
Update the following file:
sudo vim /etc/systemd/resolved.conf
Add this line, which uses Cloudflare’s DNS resolver:
DNS=1.1.1.1