This is a mono repository for my entire homelab configuration, including my Kubernetes cluster and Docker instance. It uses Infrastructure as Code (IaC) and GitOps practices as much as possible using tools like Kubernetes, Flux, Renovate, Doco-CD, and GitHub Actions. All secrets are using 1Password Connect with the exception of 1 or 2 which are SOPS encrypted.
My Kubernetes cluster is deployed with Talos. This is a semi-hyper-converged cluster, workloads and block storage are sharing the same available resources on my nodes while I have a separate TrueNAS server for NFS/SMB shares, AI, bulk file storage and backups.
- cert-manager: Creates SSL certificates for services in my cluster.
- cilium: eBPF-based networking for my workloads.
- envoy: Modern Kubernetes Gateway provider
- rook: Distributed storage provider for peristent storage using CEPH
- volsync: Asynchronous data replication for Kubernetes volumes to NAS via NFS
- external-secrets: Managed Kubernetes secrets using 1Password Connect.
- sops: Managed secrets for Kubernetes and Terraform/OpenTofu which are commited to Git.
Flux watches the clusters in my kubernetes folder (see Directories below) and makes the changes to my clusters based on the state of my Git repository.
Flux will apply all in kubernetes/apps
Flux will recursively search sub folders until it finds the most top level kustomization.yaml per directory and then apply all the resources listed in it. That aforementioned kustomization.yaml will generally only have a namespace resource and one or many Flux kustomizations (ks.yaml). Under the control of those Flux kustomizations there will be a HelmRelease or other resources related to the application which will be applied.
Renovate watches my entire repository looking for dependency updates, when they are found a PR is automatically created. When PRs are merged Flux applies the changes to my cluster.
My Docker instance is running on my TrueNAS server and managed by Doco-CD with GitOps practices, it runs AI workloads that require a dedicated NVidia GPU, Ser2Net for my Zigbee adapter and more, I've tried to limit as much as possible what the NAS does and where possible offloaded it to the Kubernetes cluster.
Doco-CD watches my docker folder (see Directories below) and makes the changes based on the state of my Git repository.
Doco-CD is controlled mostly from a single file, the .doco-cd.yaml file. This is the file that tells Doco-CD what folders to search for compose files to deploy.
- 3x Computers (I'm using Dell Optiplex 3060's with 2.5Gbe Ethernet)
- Linux or WSL on Windows is preferred
- Brew -
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Create a new repository by clicking the green
Use this templatebutton at the top of this page, then clone the new repo you just created andcdinto it.
Warning
As this repository assumes it's for myself, there are many hardcoded domain name references currently set, I would recommend find and replacing all references of ${SECRET_EXTERNAL_DOMAIN} with your own tld and f9-casa with your own tld replacing dots with dashes, you will ofcourse also need to update any secret files with your own values.
Critical Files that will need updating are
Other files should be updated, but these ones will stop deployment working
Proxmox Talos VM's, Basic Kubernetes cluster with Cilium
- Ensure the following enviroment variables are set to the correct values/paths
PROXMOX_VE_USERNAME,PROXMOX_VE_PASSWORD
export PROXMOX_VE_USERNAME="root@pam"
export PROXMOX_VE_PASSWORD="password"-
Edit the
infrastructure/talos/prod.auto.tfvarsfile to reflect your desired configuration, refer to comments for explanations of eaach variable -
Execute the Infrastructure Bootstrap script
rm infrastructure/talos/output/* # WARNING! This will delete your old kube-config and talos-confg
rm infrastructure/talos/terraform.tfstate # WARNING! This will delete state
rm infrastructure/talos/terraform.tfstate.backup # WARNING! This will delete state
chmod +x ./infrastructure//talos/bootstrap.sh
./infrastructure/talos/bootstrap.shTip
Optionally add --dry-run/-d to test it, or if you are feeling brave --auto-approve/-y to skip confirmation prompts
Note
Approximate time to deploy: 5 Minutes (assuming NVME storage)
- Ensure you have updated all your
*sops*files inkubernetes/**to match your own values
Note
Not many of them have sample files currently but eventually i will ensure every *sops* file has a matching *.sample file
[!TIP]
If you are using VSCode you should be able to automatically encrypt your sops files.
- Ensure the following enviroment variables are set to the correct values/paths
SOPS_AGE_KEY_FILE,KUBECONFIG,GITHUB_OWNER,GITHUB_REPO
export SOPS_AGE_KEY_FILE=$PWD/.age.key
export KUBECONFIG=$PWD/infrastructure/talos/output/kube-config.yaml
export GITHUB_REPO="https://github.com/fma965/f9-homelab" # replace with your github repo url- Execute the Kubernetes Bootstrap script
chmod +x ./kubernetes/bootstrap.sh
./kubernetes/bootstrap.shTip
Optionally if you are feeling brave --auto-approve/-y to skip confirmation prompts
Note
Approximate time to deploy: 10 Minutes (assuming NVME storage, excluding PV restore if applicable)
Warning
If you do not intend to use Docker skip this stage
Note
Currently Komodo does not support adding of a Git Repo via the km CLI, once this is added we can automate this a bit more
- Install Komodo from the AppStore (TrueNAS) or Docker Compose files (UnRaid / Other)
- Access the Komodo WebUI
- Navigate to "Settings" > "Profile" and create a "New Api Key", copy the Key and Secret in to the Komodo 1Password entry
- Navigate to "Settings" > "Providers" and add a Github.com Account using your token (regenerate it in Github if needed)
- Navigate to "Syncs" and Create a New Resource Sync called "f9-homelab"
- Set the Mode to "Git Repo", Repo to "fma965/f9-homelab"
- Set the Account to "fma965"
- Add the following resource path
docker/komodo.toml - Enable "Delete Unmatched Resources" and "Managed"
- Make sure only "Sync Resources" is checked under the Include section
- Click "Save", Click "Refresh" and the "Execute"
Click here to the directories of this Git Repo with descriptions
.
โโโ ๐ docker
โ
โโโ ๐ infrastructure
โ โโโ ๐ talos
โ โโโ ๐ output # Terraform output artifacts
โ โโโ ๐ talos ๐ค # Talos Linux Kubernetes configurations
โ
โโโ ๐ kubernetes
โโโ ๐ apps
โ โโโ ๐ backup ๐พ # Backup solutions
โ โโโ ๐ ceph-csi ๐พ # Ceph CSI storage driver
โ โโโ ๐ cert-manager ๐ # SSL certificate management
โ โโโ ๐ default ๐ # Dashboard and landing page
โ โโโ ๐ external-secrets ๐คซ # External secret management
โ โโโ ๐ flux-system โก # GitOps management (FluxCD)
โ โโโ ๐ game ๐ฆ # Game servers
โ โโโ ๐ git โ # Git services
โ โโโ ๐ kube-system โ๏ธ # Core Kubernetes system components
โ โโโ ๐ observability ๐๏ธ # Monitoring and logging stack
โ โโโ ๐ openebs-system ๐พ # Container Attached Storage (OpenEBS)
โ โโโ ๐ postgresql ๐ # PostgreSQL databases
โ โโโ ๐ redis ๐ง # Redis key-value stores
โ โโโ ๐ security ๐ก๏ธ # Security tools
โ โโโ ๐ system-upgrade โฌ๏ธ # Kubernetes node upgrade controller
โ โโโ ๐ traefik ๐ฆ # Ingress controller and reverse proxy
โ โโโ ๐ volsync ๐ # Volume snapshot and replication
โ โโโ ๐ webdev ๐ # Web development projects
โโโ ๐ components
โ โโโ ๐ common โ๏ธ # Shared Kubernetes components
โ โโโ ๐ gatus
โ โโโ ๐ volsync
โ โโโ ๐ volsync-backuponly
โโโ ๐ flux
โโโ ๐ cluster โก # GitOps cluster definitionsMost of my infrastructure and workloads are self-hosted and do not rely upon cloud services, some however do, here is a list of them. Note that some of these may not be part of this repo but rather just things that i also use in relation to it.
| Service | Use | Cost |
|---|---|---|
| 1Password | Secrets with External Secrets | ~$40/yr |
| Cloudflare | Domain | ~ยฃ6/yr |
| GCP | Voice interactions with Home Assistant over Google Assistant | Free |
| GitHub | Hosting this repository and continuous integration/deployments | Free |
| Discord | Alerts and notifications | Free |
| Pushover | Kubernetes Alerts and application notifications | $5 OTP |
Check out my Wiki to see more about my hardware and much more
Thanks to the Home Operations / OneDr0p Discord and community.
