Khue’s Homelab
Features • Get Started • Documentation
This project utilizes Infrastructure as Code and GitOps to automate provisioning, operating, and updating self-hosted services in my homelab. It can be used as a highly customizable framework to build your own homelab.
What is a homelab?
A homelab is a laboratory at home where you can self-host, experiment with new technologies, practice for certifications, and so on. For more information, please see the r/homelab introduction and the Home Operations Discord community (formerly known as k8s-at-home).
If you encounter an issue, please create a bug report (avoid asking for support about issues specific to this project in other communication channels).
Overview
Project status: BETA
I’ve been using it to self-host personal apps for a few years now, but it’s not stable yet. Expect breaking changes during upgrades. More information can be found in the roadmap below.
Hardware
- 4 × NEC SFF
PC-MK26ECZDR(Japanese version of the ThinkCentre M700):- CPU:
Intel Core i5-6600T @ 2.70GHz - RAM:
16GB - SSD:
128GB
- CPU:
- TP-Link
TL-SG108switch:- Ports:
8 - Speed:
1000Mbps
- Ports:
And yes, I’m still using these 10-year-old mini PCs in 2026. You don’t need much to self-host :)
Features
- Common applications: Forgejo, Immich, OpenCloud, Matrix…
- Automated bare metal provisioning with PXE boot
- Automated Kubernetes installation and management
- Installing and managing applications using GitOps
- Automatic OS rolling upgrade
- Automated version update (with approval)
- Modular architecture, easy to add or remove features/components
- Automated certificate management
- Automatically update DNS records for exposed services
- VPN (Tailscale or WireGuard)
- Expose services to the internet securely with Cloudflare Tunnel
- CI/CD platform
- Private container registry
- Distributed storage
- Support multiple environments (staging, production)
- Monitoring and alerting
- Automated backup and restore
- Single sign-on
- Infrastructure testing
Some demo videos and screenshots are shown here. They can’t capture all the project’s features, but they are sufficient to get a concept of it.
| Demo |
|---|
![]() |
| Deploy with a single command (after updating the configuration files) |
![]() |
| PXE boot |
![]() |
| Observe network traffic with Kiali |
![]() |
| Home dashboard powered by Glance |
| Monitoring dashboard powered by Grafana |
![]() |
| Git server powered by Forgejo |
![]() |
| Continuous integration with Forgejo Actions |
![]() |
| Matrix chat (FluffyChat UI) |
![]() |
| Photo library powered by Immich |
![]() |
| File storage powered by OpenCloud |
![]() |
| Container registry powered by Zot |
| Continuous deployment with ArgoCD |
![]() |
| Single sign-on powered by Kanidm |
| ntfy displaying received alerts |
Tech stack
| Logo | Name | Description |
|---|---|---|
| Argo CD | GitOps tool built to deploy applications to Kubernetes | |
| cert-manager | Cloud native certificate management | |
| Cloudflare | DNS, Tunnel and R2 for OpenTofu state | |
| ExternalDNS | Synchronizes exposed Kubernetes Services and HTTPRoutes with DNS providers | |
| Forgejo | Self-hosted Git service and CI | |
| Go | Infrastructure tests with Go | |
| Grafana | Observability platform | |
| Helm | The package manager for Kubernetes | |
| Istio | Kubernetes service mesh and gateway | |
| K3s | Lightweight distribution of Kubernetes | |
| Kanidm | Modern and simple identity management platform | |
| kube-vip | Provides virtual IPs and load balancer for the Kubernetes API and Services | |
| Kubernetes | Container-orchestration system, the backbone of this project | |
| Loki | Log aggregation system | |
| NixOS / Nix | Base OS and convenient development shell | |
| Nixie | Open-source bare metal provisioning engine for NixOS | |
| OpenBao | Secrets management | |
| OpenTofu | Open-source Infrastructure as Code | |
| Prometheus | Systems monitoring and alerting toolkit | |
| Renovate | Automatically update dependencies | |
| Rook Ceph | Cloud-Native Storage for Kubernetes | |
| Terragrunt | Coordinate OpenTofu modules | |
| Velero | Backs up and restores Kubernetes | |
| Zot Registry | Private container registry |
Get Started
Roadmap
See the roadmap and open issues for a list of proposed features and known issues.
Contributing
Any contributions you make are greatly appreciated.
Please see the contributing guide for more information.
License
Copyright © 2020 - 2026 Khue Doan
Distributed under the GPLv3 License.
Acknowledgements
References:
- Ephemeral PXE server inspired by Minimal First Machine in the DC
- ArgoCD usage and monitoring configuration in locmai/humble
- README template
- Run the same Cloudflare Tunnel across many
cloudflaredprocesses - MAC address environment variable in GRUB config
- Official k3s systemd service file
- Official Cloudflare Tunnel examples
- Initialize GitOps repository on Gitea and integrate with Tekton by RedHat
- SSO configuration from xUnholy/k8s-gitops
- Pre-commit config from k8s-at-home/flux-cluster-template
- Diátaxis technical documentation framework
- Official Terratest examples
- Self-host an automated Jellyfin media streaming stack
- App Template Helm chart by bjw-s
- Various application configurations in onedr0p/home-ops
Here is a list of the contributors who have helped to improve this project. Big shout-out to them!
@locmai
@MatthewJohn
@karpfediem
@linhng98
@elliotblackburn
@dotdiego
@Crimrose
@eventi
@Bourne-ID
@akwan
@trangmaiq
@tangowithfoxtrot
@raedkit
@ClashTheBunny
@retX0
@zalsader
@serpro69
@llajas
@zalsader
If you feel you’re missing from this list, please feel free to add yourself in a PR.
Stargazers over time
Prerequisites
Fork this repository
Because this project applies GitOps practices, it’s the source of truth for my homelab, so you’ll need to fork it to make it yours:
Hardware requirements
Initial controller
Note
The initial controller is the machine used to bootstrap the cluster. We only need it once; you can use your laptop or desktop.
- A Linux machine with Nix and
sudoaccess (for privileged ports when PXE booting with Nixie). - An SSH agent, preferably with a TPM-backed key to keep the private key in hardware.
- Add your public SSH key to
infra/src/modules/metal/flake/authorized_keys.
Servers
Any modern x86_64 computer should work. You can use old PCs, laptops, or servers.
Note
These are the requirements for each node.
| Component | Minimum | Recommended |
|---|---|---|
| CPU | 2 cores | 4 cores |
| RAM | 8 GB | 16 GB |
| Hard drive | 128 GB | 512 GB (depending on your storage usage; the base installation will not use more than 128 GB) |
| Node count | 1 (check out the single node cluster adjustments tutorial) | 3 or more for high availability |
Additional capabilities:
- Ability to boot from the network (PXE boot)
- Wake-on-LAN capability, used to wake the machines up automatically without physically touching the power button
Network setup
- All servers must be connected to the same wired network as the initial controller
- Access to your domain’s DNS settings in Cloudflare
BIOS setup
Note
You need to do this once per machine if the default config is not sufficient. Usually, this cannot be automated on consumer hardware (it requires something like IPMI to automate).
Common settings:
- Enable Wake-on-LAN (WoL) and network boot
- Use UEFI mode and disable CSM (legacy) mode
- Disable secure boot
Boot order options (select one; each has its pros and cons):
- Only boot from the network if no operating system is found: works on most hardware but you need to manually wipe your hard drive or delete the existing boot record for the current OS
- Prefer booting from the network if turned on via WoL: more convenient, but your BIOS must support it, and you must test it thoroughly to ensure you don’t accidentally wipe your servers
Note
Example
Below is my BIOS setup for reference. Your motherboard may have a different name for the options, so you’ll need to adapt it to your hardware.
Devices: NetworkSetup: PXEIPv4: true PXEIPv6: false Advanced: CPUSetup: VT-d: true Power: AutomaticPowerOn: WoL: Automatic # Use network boot if Wake-on-LAN Security: SecureBoot: false Startup: CSM: false
Gather information
- MAC address for each machine
- OS disk name (for example
/dev/sda) - Choose a static IP address for each machine (just the desired address, we don’t set anything up yet)
- Choose an unused IP range for LoadBalancer Services (e.g.
192.168.1.224/27) and a control-plane VIP (e.g.192.168.1.100) - Subnet prefix length and gateway
External resources
Although I try to keep external resources to a minimum, a few are still needed. Create an account for:
- Cloudflare
- Backblaze
We use them for:
| Provider | Resource | Purpose |
|---|---|---|
| Cloudflare | R2 bucket | OpenTofu state |
| Cloudflare | DNS | DNS and DNS-01 challenge for certificates. A domain managed by Cloudflare is required. |
| Cloudflare | Tunnel | Expose services to the internet without port forwarding |
| Backblaze | B2 bucket | Encrypted volume backups |
To avoid vendor lock-in, each external provider must have an equivalent alternative that is easy to replace:
- Cloudflare R2 and Backblaze B2: any other S3-compatible object storage.
- Cloudflare Tunnel: access everything via VPN, or use port forwarding, or a small VPS with WireGuard to route traffic (see also awesome tunneling).
Configuration
Configure nodes
Edit infra/production/metal/hosts.json with your machines’ static IPs, MAC addresses, and disk paths.
Installation erases the disks.
Note
Example
{ "homelab-1": {"ip": "192.168.1.110", "mac_address": "02:00:00:00:00:01", "disk": "/dev/sda"}, "homelab-2": {"ip": "192.168.1.111", "mac_address": "02:00:00:00:00:02", "disk": "/dev/sda"}, "homelab-3": {"ip": "192.168.1.112", "mac_address": "02:00:00:00:00:03", "disk": "/dev/sda"}, "homelab-4": {"ip": "192.168.1.113", "mac_address": "02:00:00:00:00:04", "disk": "/dev/sda"} }
Configure the cluster
Edit infra/production/cluster/config.json with your network settings.
Set init_host to a host in the inventory:
{
"init_host": "homelab-1",
"vip": "192.168.1.100",
"load_balancer_cidr": "192.168.1.224/27",
"network": {"prefix_length": 24, "gateway": "192.168.1.1"}
}
Configure services
Update the following settings in infra/production/:
domainin thedns,tunnel,argocd, andplatformTerragrunt unitszone_namein thednsunit
Review the settings in apps/*.yaml, including image registries and homepage links.
Create credentials
You’ll need a password manager to store credentials.
I’m using pass,
but you can use any password manager with a CLI.
Example change to infra/${ENV}/.envrc for another password manager
(in this case Bitwarden):
-CLOUDFLARE_API_TOKEN="$(pass "homelab/production/cloudflare/token")"
+CLOUDFLARE_API_TOKEN="$(bw get password "homelab/production/cloudflare/token")"
Tip
Prefer offline-first password managers such as
passor KeePassXC so infrastructure bootstrap doesn’t depend on an external online service.
Cloudflare
- Add your domain to Cloudflare and enable R2.
- Create a token under Manage Account -> Account API Tokens -> Create Token -> Start from scratch:
| Scope | Permission | Access |
|---|---|---|
| Entire Account | Account API Tokens | Edit |
| Entire Account | Workers R2 Storage | Edit |
| Specified Domains | DNS | Edit |
| Specified Domains | Zone | Read |
| Entire Account | Cloudflare One Connector: cloudflared | Edit |
Then store the credentials in your password manager, e.g.:
pass insert homelab/production/cloudflare/account-id
pass insert homelab/production/cloudflare/token-id
pass insert homelab/production/cloudflare/token
Backblaze
Generate a new B2 master application key and store the credentials in your password manager, e.g.:
pass insert homelab/production/backblaze/key-id
pass insert homelab/production/backblaze/key
Important
Each B2 account has one master application key, so you likely need to use the same key for both staging and production.
After examining the diff, commit and push the changes. Continue with deployment.
Deployment
First set up the development shell if you haven’t already.
Deploy the lab:
just deploy production
Yes it’s that simple!
It will take a while to download everything, you can read the architecture document while waiting for the deployment to complete.
Post-installation
Access the cluster
Export the environment’s kubeconfig, e.g., production:
export KUBECONFIG="$PWD/infra/production/kubeconfig.yaml"
Create users
Follow the user onboarding guide to create accounts and assign access. Use SSO to sign in to applications.
Verify backups
Follow the backup and restore guide to check backups and restore data.
Run tests
Run offline checks:
just test
Run live tests against staging:
just test e2e staging
See the testing reference for individual checks.
VPN setup
You can choose between Tailscale, WireGuard, or use both like me. I primarily use WireGuard but keep Tailscale as a backup for when the WireGuard server is down.
Tailscale (requires third-party account)
Tailscale provides access through a subnet router in the cluster.
-
Select the environment’s kubeconfig:
export KUBECONFIG="$PWD/infra/production/kubeconfig.yaml" -
Read the router’s login URL:
kubectl -n tailscale logs deployment/tailscale -
Open the login URL and enroll the device in your tailnet.
-
Approve its advertised subnet in the Tailscale admin console.
-
Install Tailscale on your devices, sign in, and enable subnet routes where required by the client.
You can invite users to your tailnet.
WireGuard (requires port-forwarding)
WireGuard Portal is available at https://vpn.<domain> with SSO.
Prerequisites
Configure port forwarding in your router for the WireGuard service.
Note
Example
Each router is different, here’s mine for reference:
- Protocol:
UDP- Start Port:
51820- End Port:
51820- Local IP Address:
192.168.1.226(find it withkubectl get service -n wireguard wireguard-wireguard)- Start Port Local:
51820- End Port Local:
51820
Configure the server
Sign in to the portal with an account in the admins group and create a server interface:
- Name:
wg0 - Address:
10.44.0.1/24 - Listen port:
51820 - Enable default peer creation
- Client network:
10.44.0.0/24 - Client endpoint:
wg.<domain>:51820 - Client allowed IPs:
10.44.0.0/24and your application LoadBalancer subnet
Choose a tunnel network that doesn’t overlap your LAN, pod, or Service networks.
Add a new device
WireGuard Portal will create one device by default. Users can add more if needed.
Install WireGuard, then download the configuration as wg0.conf or scan its QR code.
Keep the configuration private.
Mobile
Scan the QR code from the portal using the official WireGuard app.
Linux
Import the WireGuard configuration using NetworkManager:
nmcli connection import type wireguard file wg0.conf
Activate the connection:
nmcli connection up wg0
Connect and test access to a private application while outside your LAN.
Headscale
Headscale is a self-hosted implementation of the Tailscale control server that does not require a third-party account. To set it up, take a look at the changes proposed by this PR.
User onboarding
For user
Ask an admin to create your account, provide the following information:
- Full name (John Doe)
- Select a username (
johndoe) - Email address (
johndoe@example.com)
For admin
Create the account and share the one-time link privately for the user to set up passkeys:
just user create production johndoe "John Doe" johndoe@example.com
To include additional access groups when creating the account:
just user create production johndoe "John Doe" johndoe@example.com admins,developers
To generate a credential reset link:
just user reset production johndoe
To update access groups:
just user groups production johndoe admins,developers
| Group | Access |
|---|---|
users | Use applications and view dashboards (added by default) |
developers | Edit dashboards and push to the GitOps repository |
admins | Admin access to applications |
PXE boot
sequenceDiagram
participant Nixie
participant Router as Router (DHCP)
participant Machines
Nixie->>Nixie: Load hosts.json
Nixie->>Machines: Check SSH availability
Note over Nixie: Skip hosts with reachable SSH.<br/>Stop if all hosts are reachable.
Nixie->>Nixie: Build NixOS installer with Nix
Nixie->>Nixie: Start ProxyDHCP, TFTP, HTTP, and API services
loop Each uninstalled machine
Nixie->>Machines: Send Wake-on-LAN packet
end
par Machines boot and install concurrently
Note over Machines: UEFI PXE boot
Machines->>Router: Broadcast DHCP discovery
Machines->>Nixie: Same broadcast
par IP configuration
Router-->>Machines: Assign IP address
and PXE discovery
Nixie-->>Machines: Offer PXE boot server (ProxyDHCP)
end
Machines->>Nixie: Discover boot file (UDP 4011)
Nixie-->>Machines: iPXE bootloader path
Machines->>Nixie: Request bootloader (TFTP)
Nixie-->>Machines: iPXE bootloader
Note over Router,Machines: iPXE repeats DHCP discovery<br/>ProxyDHCP supplies the boot-script URL
Machines->>Nixie: Request boot script, then kernel and initrd (HTTP)
Nixie-->>Machines: Boot script, kernel, and initrd
Note over Machines: Boot NixOS installer<br/>systemd starts nixie-agent
Machines->>Nixie: GET /source.tar.gz
Nixie-->>Machines: Flake source and host configuration
Machines->>Nixie: POST /status (installation started)
Note over Machines: Agent builds disko, partitions disks,<br/>and runs nixos-install locally
Machines->>Nixie: POST /status (installation progress)
Note over Machines: Schedule reboot into installed system
Machines->>Nixie: POST /status (installation complete, reboot scheduled)
end
Note over Nixie: Shut down after all hosts report completion.<br/>Cluster readiness is checked separately.
Here’s how it looks like in action (this is an old clip so the logs look different now):
Secrets management
Overview
- Secrets are stored in OpenBao.
- Integrate with GitOps using the Bank-Vaults secrets webhook.
- Secrets that can be generated are automatically generated and stored in OpenBao.
flowchart TD
operator[Bank-Vaults operator] -- generate --> OpenBao
setup[Just recipes] -- sync infrastructure secrets --> OpenBao
webhook[Secrets webhook] -- read --> OpenBao
subgraph app-namespace[application namespace]
Secret --> App
end
webhook -- inject --> Secret
Generated and external secrets
- Bank-Vaults generates secrets configured in
infra/src/modules/platform/openbao.tf, keeping existing values. just deploysyncs infrastructure credentials from OpenTofu’ssecretsoutputs, along with SSO and Forgejo credentials.
Infra secret outputs
To publish secrets from an OpenTofu module, add a sensitive secrets output.
output "secrets" {
sensitive = true
value = {
"cert-manager/cloudflare" = { # OpenBao path
api_token = cloudflare_account_token.cert_manager.value # secret values
}
}
}
just deploy production writes these under OpenBao’s secret KV mount.
Secret injection
Secrets use <namespace>/<name> paths, for example forgejo/admin.
Applications can only read secrets for their own namespace.
When you apply a Secret containing a reference, for example:
apiVersion: v1
kind: Secret
metadata:
name: forgejo-admin
namespace: forgejo
stringData:
username: forgejo_admin
password: bao:secret/data/forgejo/admin#password
The webhook reads the password from OpenBao and stores it in the Kubernetes Secret.
References are resolved when the Secret is created or updated. After rotation, reapply the references and restart the applications using the Secret.
Please see the official documentation for more information.
Certificate management
Certificates are generated and managed by cert-manager with Let’s Encrypt, and renewed automatically.
cert-manager watches Gateway resources across the cluster.
When you create a Gateway with the issuer annotation:
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
annotations:
cert-manager.io/cluster-issuer: acme
name: gateway
namespace: istio-system
spec:
gatewayClassName: istio
listeners:
- name: https
hostname: '*.example.com'
port: 443
protocol: HTTPS
tls:
mode: Terminate
certificateRefs:
- name: wildcard-tls
allowedRoutes:
namespaces:
from: All
flowchart LR
User -- 6 --> Gateway
subgraph cluster[Homelab cluster]
Gateway --- Secret
Gateway -. 1 .-> Certificate
Certificate -. 5 .-> Secret
Certificate -- 2 --> CertificateRequest -- 3 --> Order -- 4 --> Challenge
end
Order -.- ACMEServer[ACME server]
subgraph dnsprovider[DNS provider]
TXT
end
Challenge -- 4.a --> TXT
ACMEServer -.- Challenge
ACMEServer -. "4.b" .-> TXT
- cert-manager creates a corresponding
Certificateresource - Based on the
Certificateresource, cert-manager creates aCertificateRequestresource to request a signed certificate from the configuredClusterIssuer - The
CertificateRequestwill create an order with an ACME server (we use Let’s Encrypt), which is represented by theOrderresource - Then cert-manager will perform a DNS-01
Challenge:- Create a DNS TXT record (contains a computed key)
- The ACME server retrieve this key via a DNS lookup and validate that we own the domain for the requested certificate
- cert-manager stores the certificate (typically
tls.crtandtls.key) in theSecretspecified in theGatewayconfiguration - Now you can access the HTTPS website with a valid certificate
A much more detailed diagram can be found in the official documentation under certificate lifecycle.
Development shell
The development shell makes it easy to get all of the tools and credentials.
Prerequisites
NixOS
Add the following to your NixOS configuration:
{
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
programs.direnv = {
enable = true;
silent = true;
};
}
Other distros
-
Install Nix using the official installer.
-
Enable Flakes in
~/.config/nix/nix.conf:experimental-features = nix-command flakes -
Install direnv and enable its shell hook.
Load the environment
From the repo root:
direnv allow .
direnv allow infra/production
direnv allow infra/staging
From now on, cd to the project automatically loads the required tools and credentials.
Testing the system
tests/ cover cluster access, networking, storage, backups, GitOps, secrets, etc.
just test
just test e2e staging
See the testing reference for more.
Expose services to the internet
Note
This tutorial is for Cloudflare Tunnel users, please skip if you use port forwarding.
Apply the environment’s tunnel unit to create a tunnel if you haven’t already,
then attach your HTTPRoute to the public Gateway (replace example.com with your domain):
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: website
namespace: website
annotations:
external-dns.kubernetes.io/cloudflare-proxied: "true"
spec:
parentRefs:
- name: public
namespace: istio-system
sectionName: https
hostnames:
- www.example.com
rules:
- backendRefs:
- name: website
port: 3000
The public Gateway supplies the DNS target for the environment’s tunnel.
Backup and restore
Prerequisites
From the development shell, select the environment and its kubeconfig:
env=production
export KUBECONFIG="$PWD/infra/$env/kubeconfig.yaml"
Back up the cluster
Velero runs hourly backups. To create one now:
velero backup create --from-schedule cluster --wait
velero backup get
velero backup describe BACKUP_NAME --details
Check the result for warnings and failed uploads.
Restore an application
Pause the affected Argo CD Applications and their ApplicationSet, then stop the workloads.
Start in read-only mode:
export TF_VAR_backup_read_only=true
(cd "infra/$env/platform" && terragrunt run apply)
Check that app reconciliation remains paused after applying the platform.
Select a backup and restore the app namespace:
velero backup get
velero restore create --from-backup BACKUP_NAME --include-namespaces APP_NAMESPACE --wait
velero restore get
velero restore describe RESTORE_NAME --details
Verify the restored data before resuming workloads and GitOps reconciliation. Then resume scheduled backups:
unset TF_VAR_backup_read_only
(cd "infra/$env/platform" && terragrunt run apply)
Dependency updates
Renovate runs weekly. To trigger it manually:
- Open Actions in the homelab repository in Forgejo.
- Select Renovate.
- Select the default branch and click Run workflow.
Use both GitHub and Forgejo
Even though we self-host Forgejo, you may still want to use GitHub as a backup and for discovery.
Add both push URLs (replace my repositories with yours):
git remote set-url --add --push origin https://git.khuedoan.com/ops/homelab.git
git remote set-url --add --push origin git@github.com:khuedoan/homelab
Now you can just run git push like usual and it will push to both GitHub and Forgejo.
Add or remove nodes
Or how to scale horizontally. To replace the same node with a clean OS, remove it and add it again.
Add new nodes
Tip
You can add multiple nodes at the same time
Add its details to the inventory:
{
"homelab-1": {"ip": "192.168.1.110", "mac_address": "02:00:00:00:00:01", "disk": "/dev/sda"},
"homelab-2": {"ip": "192.168.1.111", "mac_address": "02:00:00:00:00:02", "disk": "/dev/sda"},
"homelab-3": {"ip": "192.168.1.112", "mac_address": "02:00:00:00:00:03", "disk": "/dev/sda"},
+ "homelab-4": {"ip": "192.168.1.113", "mac_address": "02:00:00:00:00:04", "disk": "/dev/sda"}
}
Install the OS and join the cluster:
just deploy production
Then verify the new node:
export KUBECONFIG="$PWD/infra/production/kubeconfig.yaml"
kubectl get nodes
That’s it!
Remove a node
Warning
It is recommended to remove nodes one at a time
Use the environment’s kubeconfig:
export KUBECONFIG="$PWD/infra/production/kubeconfig.yaml"
Drain the node:
kubectl drain ${NODE_NAME} --delete-emptydir-data --ignore-daemonsets --force
Remove the node from the cluster
kubectl delete node ${NODE_NAME}
Shutdown the node:
ssh root@${NODE_IP} poweroff
Remove it from the inventory:
{
"homelab-1": {"ip": "192.168.1.110", "mac_address": "02:00:00:00:00:01", "disk": "/dev/sda"},
"homelab-2": {"ip": "192.168.1.111", "mac_address": "02:00:00:00:00:02", "disk": "/dev/sda"},
"homelab-3": {"ip": "192.168.1.112", "mac_address": "02:00:00:00:00:03", "disk": "/dev/sda"},
- "homelab-4": {"ip": "192.168.1.113", "mac_address": "02:00:00:00:00:04", "disk": "/dev/sda"}
}
Reapply the environment with just deploy production.
Don’t replace the initializer with a fresh server in an existing cluster.
Optionally, after Ceph finishes recovering, clean up the removed node’s OSD records using the Rook guide.
Single node cluster adjustments
Warning
This is not officially supported and I don’t regularly test it, I highly recommend using multiple nodes.
Using a single node could lead to data loss unless your backup strategy is rock solid, make sure you are ABSOLUTELY CERTAIN this is what you want.
Make the following changes, then commit and push.
Configure the node
- Keep one host in
infra/production/metal/hosts.json. - Set it as
init_hostininfra/production/cluster/config.json.
Remove storage redundancy
Set ceph_replica_count to 1 in the inputs block of infra/production/platform/terragrunt.hcl:
ceph_replica_count = 1
Updating documentation (this website)
This project uses the Diátaxis technical documentation framework. The website is generated using mdBook and can be viewed at homelab.khuedoan.com.
There are 4 main parts:
- Getting started (tutorials): learning-oriented
- Concepts (explanation): understanding-oriented
- How-to guides: goal-oriented
- Reference: information-oriented
Local development
To edit and view locally, run:
just docs
Then visit localhost:8000
Deployment
It’s running on GitHub Pages under the pages branch
(so even if my homelab goes down everyone can still read the documentation).
To publish:
just publish
PXE boot
PXE server logs
View the Nixie output in the terminal running just deploy production (or staging).
To retry metal provisioning:
just infra apply production --filter metal
Nodes not booting from the network
- Plug a monitor and a keyboard to one of the bare metal node if possible to make the debugging process easier
- Check if the controller (PXE server) is on the same subnet with bare metal nodes (sometimes Wifi will not work or conflict with wired Ethernet, try to turn it off)
- Check if bare metal nodes are configured to boot from the network
- Check if Wake-on-LAN is enabled
- Check the controller’s firewall config to make sure that the following ports are open:
- UDP 67 and 68 for DHCP
- UDP 69 for TFTP
- UDP 4011 for the PXE boot service
- TCP 80 for the boot files
- TCP 5000 for the installer callback API
- Check if the servers are booting to the correct OS (NixOS installer instead of the previously installed OS), if not try to select it manually or remove the previous OS boot entry
- Examine the network boot process with Wireshark or Termshark
Verify your authorized SSH keys and trusted host keys if provisioning succeeds but enrollment fails.
Overview
Components
Main components:
./infra: bare metal management, Kubernetes, and platform services./apps: user facing applications
Support components:
./docs: all documentation go here, this will generate a searchable web UI./tests: automated tests for the entire system
Provisioning flow
After editing the configuration files, run a single just command to:
- (1) Apply the
metalandclusterunits:- Create an ephemeral, stateless PXE server
- Install NixOS on all servers in parallel
- Build a Kubernetes cluster (based on k3s)
- Export and verify its kubeconfig
- (2) Bootstrap GitOps with ArgoCD
- (3) Deploy platform components
- (4) Push the GitOps repo to Forgejo
- (5) Deploy applications in
./appswith ArgoCD
flowchart BT
cluster@{ shape: processes, label: "Servers<br/>NixOS + Kubernetes" } -->|Bootstrap| argocd[Argo CD]
argocd -->|Deploy| platform@{ shape: processes, label: "Platform services<br/>Networking, storage, identity and secrets" }
argocd -->|Deploy| apps@{ shape: processes, label: "Applications" }
platform -->|Support| apps
repository@{ shape: docs, label: "GitOps repository<br/>Application configuration" } --> argocd
cloudflare[DNS and Tunnel] -.->|DNS and connectivity| platform
backup[(Backup bucket)] -.->|Backup and restore| platform
Networking
flowchart TD
subgraph LAN
laptop/desktop/phone <--> LoadBalancer
subgraph k8s[Kubernetes cluster]
Gateway --> Service
Service --> Pod
LoadBalancer[kube-vip Service VIP]
Gateway[Istio gateways]
cloudflared
cloudflared <--> Gateway
end
LoadBalancer <--> Gateway
end
cloudflared -- outbound --> Cloudflare
Internet -- inbound --> Cloudflare
- Flannel provides pod networking.
- kube-vip provides the control-plane VIP and Service load balancing.
- Tailscale and WireGuard provide remote access when you’re not at home.
- Istio gateways route HTTP traffic to applications.
- Cloudflare Tunnel exposes services to the internet through an outbound connection.
- Istio ambient mesh encrypts traffic between application Pods with strict mTLS without sidecars, with traffic visualization using Kiali.
Decision records
These are the records of design decisions for future reference in order to understand why things are the way they are. They are not permanent, I can change them in the future if better alternatives become available.
Current decisions
Using NixOS as the base OS
Context
With Fedora and Ansible, I sometimes make manual changes and forget to put them back in the playbooks. If a playbook fails halfway, it’s also hard to roll back to the previous system.
I’ve also considered other atomic distros, for example Talos is smaller and has better integration for Kubernetes operations, but I want a general-purpose OS that can stay even if I move away from Kubernetes. I don’t want the OS to depend on a single company that could change its license, and I already use NixOS on my other machines.
Decision
Use NixOS as the base OS.
Consequences
- System changes have to go through the NixOS configuration, so it’s easier to keep the system clean and reproducible.
- NixOS builds the new system before switching to it, and I can roll back to a previous generation. Switching to the new system is almost fully atomic, except for service activation and restarts, which are still imperative.
- I can use Nix for both the OS and development shells, without installing project dependencies into the base system.
- I can test the same configurations in QEMU before applying them to real hardware.
- I can keep the OS even if I replace Kubernetes later.
- The system is larger than Talos, with a larger attack surface, and I need to coordinate rolling upgrades myself.
See the original discussion and NixOS cured my OCD for more background.
Switch metal provisioning from Ansible to Nixie
Context
The metal nodes used to use Ansible to install Fedora. When I switched to NixOS, I could still use Ansible to install it, but it was hard to test and debug.
Decision
Build a custom bare metal orchestration engine for NixOS - nixie.
Nixie installs from the NixOS configuration, replacing Kickstart without needing cloud-init. It works with VMs too. My staging cluster runs on Incus VMs that I regularly destroy and recreate, while production runs on bare metal. See PXE boot for the installation flow.
Consequences
- Single binary with native OS process instead of complex Ansible & Docker Compose setup (& its host networking baggage)
- It has much better integration to the OS, since it’s built specically for NixOS
- It’s much more reliable and testable (Nixie has a full test suite in QEMU)
- There’s much better visibility into the PXE boot process with tracing
- The PXE installer can be reused with other projects (e.g., my dotfiles), not just this homelab.
K3s
K3s is reliable, well supported, and available in nixpkgs with a NixOS module.
I’ve been using it for years without issues that would make me want to replace it.
I replace the bundled Traefik, ServiceLB, and local storage with Istio, kube-vip, and Rook Ceph.
Replace ingress-nginx with Istio
I want a service mesh for observability, security, and traffic routing, and I need Gateway API support anyway. Istio provides both, and I’m already running it in production. Ambient mesh has the features I need without sidecar overhead.
I keep Flannel for pod networking and kube-vip for the control-plane VIP and Service load balancing. Keeping the existing CNI makes it easy to port the platform to cloud-managed Kubernetes without bringing my own CNI.
Application routes use Gateway API, and ambient mesh encrypts traffic between application Pods with strict mTLS. See Networking for the current setup.
Use Rook Ceph for storage
Ceph is reliable, battle-tested distributed storage, and Rook manages it in Kubernetes. I’ve tried Longhorn but still ran into volume detachment issues. A single NFS server would be a single point of failure, which I don’t want for cluster storage. Ceph is more complex to operate, but its reliability is worth it to me.
Use Velero for backups
Context
Requirements:
- All apps backed up by default, without additional configuration for new apps.
- The backups need to work even if I lose the entire cluster.
I used to use VolSync, but its Restic workflow requires per-volume replication resources and credentials, and the backup & restore flow is not really declarative. I would need additional resource generation and orchestration to provide this experience.
Decision
Use Velero to back up cluster resources and supported persistent volumes:
- Use CSI snapshot data movement to copy volume data into object storage, so recovery does not depend on the original Ceph cluster.
- Use Velero’s ReadOnly recovery mode to prevent backup creation and deletion while restoring and verifying data.
Consequences
- The backup schedule includes all apps, without backup resources or storage credentials to distribute to app namespaces.
- Backup and restore operations use Velero’s native resources and CLI.
- Velero requires broad cluster permissions.
- Database applications may still need backup hooks or native exports for consistent backups.
Use Kanidm for identity
I want a reliable, secure identity provider. I trust Kanidm’s maintainer and track record, and its use of Rust gives me more peace of mind.
I only use Kanidm and don’t plan to switch identity providers. Dex helped with client IDs and secrets, but added another layer and limited which Kanidm features I could use. I now integrate with Kanidm directly and automate client provisioning myself. If I switch providers later, rewriting the automation scripts is a small enough cost.
Use OpenBao for secrets
I need an API to provision application credentials automatically. For example, SSO setup can create a Kanidm client secret and write it to OpenBao for the application to use.
I could do this with the Kubernetes Secret API, but I also want secret injection and namespace-scoped access policies. Applications should only be able to read secrets under their own namespace’s path. OpenBao provides those guardrails, with Bank-Vaults handling secret injection. It’s more to maintain than the previous global secret store, but worth it for these features.
See Secrets management for the implementation.
Manage platform components through OpenTofu and ArgoCD
I already need OpenTofu for infrastructure and a way to bootstrap the platform. It gives me templating and dependency ordering, while ArgoCD deploys and reconciles the workloads. I prefer HCL to Helm templates or string replacement. User applications stay in GitOps, managed by ArgoCD.
Terragrunt gives each provisioning unit its own state and provider configuration. It handles dependencies between units without custom orchestration. The cluster must exist before I can initialize the Kubernetes and Helm providers for platform components.
OpenTofu can also provision secrets before OpenBao is available. Velero needs this because it must be able to restore OpenBao, so its credentials can’t depend on OpenBao being up first.
Use app-template for all applications
I want consistent application configuration so I can apply platform requirements like ambient mesh and future security settings in one place. All applications use app-template, with a shared ApplicationSet handling platform integration. I lose some flexibility and can’t reuse upstream Helm charts directly, but so far I’ve been able to convert every application.
App-template supports arbitrary resources through rawResources, so the chart alone isn’t a guardrail.
I use separate ArgoCD projects: platform components need cluster-wide privileges, while applications have a resource allowlist.
This gives me more confidence that application changes have a contained blast radius.
Use Forgejo as the GitOps source
The point of this project is to self-host, so that includes Git. I don’t want a critical platform feature to depend on a closed-source third-party service like GitHub. Forgejo lets me control the GitOps source end-to-end. If it’s down, I can still update things manually or fix it myself.
Self-hosting everything has to be practical. If it’s too complex, people won’t do it. I’m fine with managed services that provide enough value without much lock-in. DNS and S3-compatible storage are good examples: they’re commodity services, and I still own my data. Tunneling is another place where a managed service can be worth it, as long as I can replace it.
Keep Tailscale as a fallback for WireGuard
I primarily use WireGuard, but my ISP has broken access through my public IP several times. Tailscale gives me another way in when that happens. I don’t want to depend on its managed control plane as my primary access method, so I keep it as a fallback.
Remove the Docker wrapper for Nix shell
Context
The Docker wrapper was originally added because not everyone has Nix installed. However, it is not a good abstraction. Depending on how Docker (or Podman) was installed, there may be permission issues, and it is slower than running Nix directly on the host.
Decision
Remove the Docker wrapper and run the Nix development shell directly. While not everyone has Nix installed, not everyone has the same Docker setup either.
Consequences
- Requires an additional step to install Nix, but this is a one-time setup.
- The
make toolscommand has been removed, you now need to runnix developdirectly. Although it can be added to theMakefile, this requiresmaketo be installed, and not everyone has the same version ofmake.
Replace Make with Just
Most of my commands are things I need to run, rather than things I need to build.
Just fits this better, with positional arguments and support for Python recipes.
Modules let me keep recipes alongside the infrastructure and tests, exposed through the root justfile.
It needs an extra installation, but I already have a Nix shell that provides it.
Historical decisions
These records describe earlier choices and are kept for context.
Remove HashiCorp Vault
Status: superseded by Use OpenBao for secrets, the community fork of Vault.
Context
- HashiCorp changed their license, and it’s no longer free/libre software. One of the highest priorities of this project is to minimize the usage of non-free software as much as possible, so I don’t really want to keep Vault, especially considering the next point.
- Vault is fairly complex to maintain properly. This project only uses Vault for two things: basic key-value secret store and its API to create and manage secrets dynamically. With the new Kubernetes secret provider in External Secrets, both features can be replaced with Kubernetes’s built-in secrets and API server.
- A related goal of using Vault as an identity provider for SSO will be discarded, and I’ll use Authelia instead, which has a beta identity provider feature (or use another alternative).
Decision
Replace Vault with a simpler in-cluster global secret store.
Consequences
Unlike secret path in Vault, Kubernetes does not support / in object name.
I need to change secret convention from path to name and replace / with ..
Update secret generator config:
-- path: gitea/admin
+- name: gitea.admin
data:
- key: password
length: 32
Update secret references in kind: ExternalSecret:
remoteRef:
- key: /gitea/admin
+ key: gitea.admin
Manage package versions in development shell
Status: I no longer need this, since I use Nix from the development shell to NixOS on the nodes.
Context
While Nix is reproducible, I need a way to control the versions of the tools and keep them up-to-date.
For example, if I update the nixpkgs hash (in flake.nix) from abcd1234 to defa5678:
ansible: 2.12.1 -> 2.12.6terraform: 1.2.0 -> 1.2.2foobar: 1.8.0 -> 1.9.0
That looks good. But when I update it from defa5678 to cdef9012:
ansible: 2.12.6 -> 2.13.0terraform: 1.2.2 -> 1.3.1foobar: 1.9.0 -> 2.0.0
This time it breaks foobar because the new major version contains a breaking change.
I can pin the specific version of each dependency in flake.nix,
however, the maintenance burden is too high (even with Renovate) because I need to update the version of each package regularly rather than just the nixpkgs hash.
Instead, I can just bump the nixpkgs hash and run some tests to ensure there is no breaking change.
Decision
Update the tests to ensure that the versions remain within the desired range (i.e. no breaking change).
Consequences
I have the rail guard from the tests to ensure that I don’t upgrade to a new major version with breaking changes, and I can make a conscious decision to take the necessary steps prior to upgrading to the new major version.
Refactor the tools container from plain Dockerfile to Nix
Status: the Docker wrapper was later removed in Remove the Docker wrapper for Nix shell.
Context
The previous implementation of the tools container is not reproducible, if someone builds it a few weeks after me, they will receive different versions of the tools. Also, if you change something in the tool list, everything will be downloaded again, with no caching.
Decision
Move to Nix shell with a Docker wrapper, in case Nix is not available (see commit adbaf32).
Consequences
- All versions are pinned
- When you change the list of tools, rebuilding is much faster
Combine dhcpd and tftpd to dnsmasq in PXE server
Status: replaced by Nixie.
Context
Original proposal from @Bourne-ID:
Issue statement
The use of dhcpd is great for air-gap solutions where a new DHCP is required. However for some home networks which does not have the VLAN capability or for users who would like to use common router DHCP services, the use of DHCPD will cause duplicate DHCP servers and will result in potential network disruption, or will limit the ability to auto-provision the Metal stage of this project.
Proposed Solution: DHCP Proxy
Use DHCP Proxy services to add PXE features such as Next Server into this project. This allows for users to use the existing DHCP servers which may be locked down or incapable of using Next Server/PXE settings on their network to be able to auto-provision hardware through PXE (with certain common configurations, like static IP allocation or reduction in DHCP request ranges on the DHCP server)
Proposed Application: DNSMasq
DNSMasq in Proxy mode interoperates with existing DHCP servers over IPv4 to add features such as next-server, TFTP, etc. where such hardware is either locked or unconfigurable for such services. This would be an opt-in change, configurable through the pxe_server defaults file.
Proposed Target Audience
Users who either do not want to create their own VLAN or lack the hardware to configure such services. Users who want to use common router services for DHCP and have router access to configure static IP and/or DHCP allocation ranges.
Additional Risks with Proposed Change
- Additional Surface Area for Break-Out Attacks: Originally this project is locked to its own DHCP/VLAN, so any break-outs should be contained accordingly. Using common home networks increases the surface area of break-out attacks if the deployment is compromised.
- Mitigation: Enrolment into this change is opt in only.
Proposed Next Steps
- Trial/Adopt/Halt - A discussion with all or a decision by the project maintainers to identify if this change should exist in this project or live on a fork.
- Documentation (This is in flight in any situation).
Decision
Migrate to dnsmasq (see commit f650c89, thanks to @Bourne-ID)
Consequences
- DHCP proxy is enabled by default because most people have a standard home network with existing DHCP server, but it can still be disabled to restore the previous behavior
Migrate documentation from mdBook to MkDocs
Status: I no longer plan to use Backstage for this homelab (I may build something else), so it’s back to mdBook, which has fewer dependencies and is faster.
Context
mdBook is very minimal and light weight, which I personally prefer. However, Backstage TechDocs which I plan to use currently only supports mkDocs.
Decision
Migrate documentation from mdBook to MkDocs (see commit cd41343).
Consequences
- I can no longer include only a portion of a file, see facelessuser/pymdown-extensions#1462.
Using Fedora as the base OS
Status: superseded by Using NixOS as the base OS
Context
I’ve tried several distributions, and each has advantages and disadvantages. Fedora has a good (enough) balance between stability and new features.
Alternatives considered:
- Fedora CoreOS (moved to Rocky in
7667254):- Pros: automatic and atomic upgrade, immutable, quick installation
- Cons: hard to run Ansible on (Python is not included)
- CentOS/Rocky Linux (moved to Fedora in
022b816):- Pros: relatively stable (however I did encounter a breaking change #63, still not sure why)
- Cons: kernel and packages are too old
- Debian: couldn’t get it to work with PXE boot and Rocky Linux was sufficient so I didn’t push any further
- Cluster API (previous attempt in
a8e4a85, I hope to get this to work someday):- Pros: control bare metal machines via Kubernetes API, open the possibility for autoscaling and autohealing
- Cons: doesn’t support simple WoL and shutdown via SSH (or similar)
Decision
Use Fedora as the base OS.
Consequences
¯\_(ツ)_/¯
CLI
Use just to run common tasks.
just --list
| Command | Purpose |
|---|---|
just deploy ENV | Deploy the lab and configure services |
just user create ENV NAME "FULL NAME" EMAIL [GROUPS] | Create a user and print an enrollment link; optional groups are comma-separated |
just user reset ENV NAME | Print a credential reset link for an existing user |
just user groups ENV NAME GROUPS | Set access groups (users is implicit) |
just infra tfstate ENV | Create the state bucket |
just infra apply ENV | Apply infrastructure |
just infra secrets ENV | Copy OpenTofu secret outputs to OpenBao |
just infra sso ENV | Configure SSO and sync OAuth credentials |
just infra forgejo ENV | Configure Forgejo and push committed HEAD |
just test | Run local checks |
just lint | Check Go and infrastructure code |
just fmt | Format code |
just docs | Preview the documentation |
See the testing reference for integration tests and benchmarks.
Testing
Run these commands from the repository root.
Local checks
just test
List available tests:
just test list
Integration tests
Run tests against staging:
just test e2e staging
| Check | What it tests |
|---|---|
| API | API readiness, node identities, and membership through the VIP |
| Networking | DNS, pod traffic, and Service traffic across nodes when available |
| NetworkPolicy | Selective egress denial and connectivity from unselected pods |
| LoadBalancer | HTTP traffic through Istio’s advertised gateway addresses |
| Storage | Data persistence with RBD and CephFS, including shared mounts |
| Snapshots | CSI snapshot creation and restore |
| Backups | Velero backup and restore through object storage |
| Secrets | OpenBao Secret injection and namespace permissions |
| Registry | HTTPS registry API, not image push or pull |
| GitOps | Argo CD deployment and self-healing |
| Apps | HTTPS responses from application routes |
You can also run individual checks:
just test e2e staging networking
Benchmarks
just test benchmarks staging
| Check | What it tests |
|---|---|
| Storage | Storage performance |
| Security | K3s CIS checks |
Changelog
v0.0.8
Notable changes:
- build: run post install scripts by default
- build: set
KUBECONFIGfrom global Makefile - feat(external-dns)!: add cluster name as owner ID
- feat(tools): install
yamllint,ansible-lintandk9s - feat(tools): set
KUBECONFIGby default - feat: add pre-commit hooks
- feat: add script to setup Gitea tokens and OAuth apps
- perf(argocd): turning on selective sync
- refactor(docs): migrate to mkdocs
- refactor(metal): migrate to Fedora 36 for newer packages
- refactor(pxe)!: combine dhcpd and tftpd to dnsmasq
- Many bug fixes
Please see git log for full change log.
0.0.7-alpha
- Replace standard Vault with Vault Operator
- Automatically initialize and unseal Vault
- Declarative secret generation and management
- Declarative Gitea configuration with YAML
- Automatic OS rolling upgrade
- Automatic Kubernetes rolling upgrade
- Automatic application updates using Renovate (still require manual token generation)
- Add script to wait for essential services after deployment
- Add icons and bookmarks to the home page
- Deploy Matrix chat
- Replace Authentik with Dex for SSO (still require manual token generation)
- Switch to Mermaid for diagrams in documentation
- Replace Vagrant with k3d for development environment
- Use nip.io domain for development environment
- Remove Backblaze (S3 Glacier and/or Minio will be added in future version)
- Enable monitor for the majority of applications
- Many code refactorings and bug fixes
0.0.6-alpha
- Upgrade to Kubernetes 1.23
- Support external resources:
- Cloudflare DNS and Tunnel
- Backblaze for backup
- Auto inject secrets to required namespaces
- Replace self-signed certificates with Let’s Encrypt production (with API token injected from the
externallayer) - Add DNS records automatically using external-dns
- Easy Cloudflare Tunnel configuration with annotations
- Offsite backup to Backblaze B2 bucket using k8up-operator
- Add private container registry
- Remove Knative to save resources (temporarily)
- Enable encryption at rest for Kubernetes Secrets
- Add more Tekton tasks and pipelines
- Initialize GitOps repository on Gitea automatically after install
- Generate MetalLB address pool automatically (default to the last
/27subnet) - Some bug fixes
0.0.5-alpha
- Add convenience scripts
- Add Loki for logging
- Add custom health check for Application and ApplicationSet
- Use Vault with dev mode on (temporarily until we hit beta)
- Replace Authelia with Authentik
- Upgrade to Kubernetes 1.22
- Upgrade most services to the latest version
- Set ingress class and storage class explicitly
- Initial Linkerd and Knative setup (not working yet)
- Set up Hajimari for home page with automatic ingress discovery
- Add dev VM for local development or evaluation
- Optimize bare metal provisioning performance
- Replace Syncthing with Seafile (may use both in the feature)
- Enable Gitea SSH cloning via Ingress
- Various code clean up
- Add more documents
0.0.4-alpha
- Switch to Rocky Linux
- Some optimization for bare metal provisioning
- Switch to k3s and combine Kubernetes cluster config in
./infralayer to./metallayer (because k3s is also configured using Ansible) - Split boostrap Helm charts in
./infralayer to./bootstraplayer (with new ArgoCD pattern) and./systemlayer - Add
./platformlayer for some applications like Gitea, Tekton… - User only need to provision
./metalandbootstraplayer, the./bootstraplayer will deploy the remaining layers - Provisioning time from empty disk to running services is significantly reduced (thanks to k3s and new bootstrap pattern)
- Use mdBook for documents
- Replace Drone CI with Tekton
- Enable TLS on all Ingresses (using cert-manager)
- Add some new applications
0.0.3-alpha
- Generate Terraform backend config automatically
- Switch to CoreOS
- Better PXE boot setup
- Diagrams as code
0.0.2-alpha
- Ensure idempotency for bare metal provisioning
- Extract instead of mounting the OS ISO file
- Easy initial controller setup (with only Docker)
- Switch to Fedora
- Remove LXD
- Move etcd (Terraform state backend) back to Docker
0.0.1-alpha
- Bare metal provisioning with PXE
- LXD cluster
- Terraform state backend (etcd)
- RKE cluster
- Core services (Vault, Gitea, ArgoCD,…)
- Public services to the internet (via port forwarding or Cloudflare Tunnel)
Roadmap
Note
Current status: BETA
Alpha requirements
Literally anything that works.
Beta requirements
Good enough for tinkering and personal use, and reasonably secure.
- Automated bare metal provisioning
- Controller setup (Nix development shell)
- OS installation (PXE boot)
- Automated cluster creation (k3s)
- Automated application deployment (ArgoCD)
- Automated DNS management
- Initialize the GitOps repository on Forgejo automatically
- Observability
- Monitoring
- Logging
- Alerting
- SSO
- Reasonably secure
- Automated certificate management
- Declarative secret management
- Replace all default passwords with randomly generated ones
- Expose services to the internet securely with Cloudflare Tunnel
- Only use open-source technologies (except external managed services)
- Everything is defined as code
- Backup solution (3 copies, 2 separate devices, 1 offsite)
- Scheduled, encrypted offsite backups
- Verify the full 3-2-1 backup strategy
- Define SLOs:
- 99% availability per application (up to 7h of downtime per month, including weekend experimentation)
- Core applications
- Forgejo
- Forgejo Actions
- Private container registry
- Homepage
Stable requirements
Can be used in “production” (for families or even small businesses).
- A single command to deploy everything
- Verify deployment time from empty disks to running services
- Fully automatic, not just automated
- Automated flake updates and node configuration deployment for OS and Kubernetes upgrades
- Rolling upgrades with cordon/drain, control-plane/worker coordination, and health checks
- Kured reboot coordination after kernel changes
- Application version upgrades
- Encrypted backups
- Secret rotation and consumer reloads
- Self-healing
- Automated flake updates and node configuration deployment for OS and Kubernetes upgrades
- Secure by default
- Host security hardening
- Default application network policies
- Static code analysis
- Automated integration tests (networking, storage, backup/restore, secrets, GitOps, etc.)
- Regular disaster recovery tests
- Minimal dependency on external services
- Complete documentation
- Diagrams as code
- Book (this book)
- More tutorials and video feature demos
- User onboarding (with
just user create) - More dashboards and alert rules
- Monitoring and alert delivery outside the cluster
- Verify mobile/desktop app clients and off-LAN VPN access
- Capacity planning and control-plane stability under load
- SLOs:
- 99.9% availability (up to 43 mins of downtime per month). Ideally 99.95% but would be hard to do with home power and internet (I might move to colo)
- Recovery from complete cluster loss (at most one hour of data loss)
- Clear upgrade path
- Additional applications
- Matrix with bridges
- VPN server
- PeerTube
- Blog
Unplanned
Nice to have.
- Air-gapped installation
- Chaos testing
Contributing
How to contribute
Bug report
You can create a new GitHub issue with the bug report template.
Submitting patches
Because you may have a lot of changes in your fork, you can’t create a pull request directly from your master branch.
Instead, create a branch from the upstream repository and commit your changes there:
git remote add upstream https://github.com/khuedoan/homelab
git fetch upstream
git checkout upstream/master
git checkout -b contrib-fix-something
# Make your changes here
#
# nvim docs/README.md
# git cherry-pick a1b2c3
#
# commit, push, etc. as usual
Then you can send the patch using GitHub pull request or git send-email to mail@khuedoan.com.
FAQ
Is it necessary to install Linux on my servers before setting up the homelab?
No, and that’s the beauty of this setup. You start with empty hard drives, type a single command on your laptop/PC, and it will install the operating system for you automatically and in parallel over the network.
Is it necessary to keep the PXE server running?
No, the ephemeral PXE server is stateless, once Linux is installed on your servers, you can shut it down (or not, ideally, you don’t even need to be aware of its existence). The Terragrunt metal module runs Nixie when you apply it.










