Containers and Kubernetes
Most self-hosted software now ships as a container, and containers use far less memory than one VM per service. Many labs now run a handful of VMs, with most services in containers inside them.
Choosing a tool
Section titled “Choosing a tool”| Tool | Choose it when |
|---|---|
| Docker with Compose | You want to run services at home. This is the default, and nearly every project documents it |
| Podman | You want rootless containers without a daemon, or you work with RHEL-family systems. Quadlet integrates containers with systemd |
| LXC | You want a lightweight Linux system that acts like a small VM, such as in Proxmox |
| Kubernetes | You want to learn Kubernetes, or you truly need scheduling across several machines |
For a single host, Compose is usually the right call. Tools such as Portainer, Dockge and Komodo add a web interface if you want one.
Do I need Kubernetes?
Section titled “Do I need Kubernetes?”If your goal is running a few services at home, no. It adds a lot of moving parts. But if you’re after skills for a platform or DevOps job, a home cluster is excellent practice, and breaking it costs you nothing.
Lightweight distributions make this practical on small hardware:
| Distribution | Notes |
|---|---|
| k3s | A single small binary. Very popular for homelabs, and runs on a Raspberry Pi |
| Talos Linux | An immutable OS built only for Kubernetes, managed entirely through an API |
| k0s | A small, self-contained distribution that’s similar to k3s |
| kind or minikube | Short-lived clusters on your laptop for study |
| kubeadm | The upstream way to build a cluster by hand. Useful preparation for CKA-style exams |
A typical learning path:
- Run k3s on one node and deploy an app.
- Add an ingress controller and cert-manager.
- Move to three nodes, and add storage using Longhorn or Rook and Ceph.
- Manage everything with GitOps, using Flux or Argo CD.
For a load balancer on bare metal, look at MetalLB or Cilium.
Running containers safely
Section titled “Running containers safely”- Pin your image versions rather than using
latest, so that updates happen when you choose. Renovate can open pull requests to update them for you. - Be careful with the Docker socket. Giving a container access to it is effectively giving that container root on the host.
- Know that Docker can bypass host firewall rules. Published ports are often reachable even when UFW or firewalld appears to block them. Bind to
127.0.0.1or a specific IP address when a service shouldn’t be public. - Back up your volumes, not just your Compose files. See Backups.
- Use trusted images, ideally ones from the project itself, and read a Compose file before you run it.
Things to run
Section titled “Things to run”The awesome-selfhosted list is a great place to find software. Common first choices include a reverse proxy (Caddy, Traefik or Nginx Proxy Manager), Pi-hole or AdGuard Home, Uptime Kuma, Home Assistant, Immich, Jellyfin and Vaultwarden.