Skip to content

About

Gitops managed homelab applications.

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

🏠 Homelab GitOps

The entire Kubernetes cluster state as code — rolled out purely via Git.

Single Source of Truth for my self-hosted homelab on Talos Linux, continuously reconciled by FluxCD. GitHub is leading; Forgejo is an in-cluster mirror.

CI Renovate SOPS Last commit

Talos Linux Kubernetes FluxCD Helm Cilium NGINX Ingress CloudNativePG cert-manager

New here? Start with docs/cluster-access.md to get a kubeconfig, then docs/applications.md to learn how to enable / disable apps and configure their hostnames.


Table of Contents


How it works

git push ──▶ GitHub (main) ──▶ FluxCD ──▶ Kustomize / Helm ──▶ Talos Cluster
                                  │
                                  └─▶ SOPS + age decrypt secrets in-cluster

Everything is declarative: the cluster's desired state lives in this repo, Flux reconciles it every hour (or on demand). Changes land via PRs to main — never kubectl edit.


Infrastructure Overview

Component Technology Role
VCS / Mirror GitHub (Primary) + Forgejo (Mirror) GitHub is leading; Forgejo is in-cluster mirror.
Secrets SOPS + age Encrypted GitOps secrets (in-repo encryption)
OS & K8s Talos Linux Immutable, RAM-based, API-managed OS
GitOps FluxCD Reconciles Git state to cluster state
CNI Cilium + Hubble eBPF pod network (VXLAN), NetworkPolicy enforcement, flow visibility; kube-proxy stays
Storage (DB) node-local local-path Per-node disks for CloudNativePG (off the iSCSI SPOF; CNPG replicates at the DB layer)
Storage (Fast) TrueNAS iSCSI (democratic-csi) RWO block storage for app state/config
Storage (Mass) NFS (External NAS) Persistent storage for media and archives
Networking NGINX Ingress / ExternalDNS Ingress control and Cloudflare DNS sync
Security cert-manager Automated TLS via Let's Encrypt (DNS-01)
Observability VictoriaMetrics Stack High-performance monitoring and alerting
Automation Renovate Bot Automated dependency and image updates
Data Policy Velero + Restic On-site Kubernetes recovery plus encrypted Immich/Nextcloud offsite backups

Applications & Status

This cluster runs a variety of self-hosted applications. Uptime is monitored via Gatus (— = no Gatus check).

Application Description Uptime
audiobookshelf Audiobook & podcast streaming server Uptime
authentik Central SSO & identity provider (OIDC) Uptime
dawarich Self-hosted location history (Google Timeline alternative) Uptime
forgejo In-cluster Git forge & mirror of GitHub Uptime
gatus Status page & uptime monitoring (source of these badges) —
goloom Plan & schedule social-media posts (Mastodon, Bluesky, …) Uptime
grafana Metrics dashboards & visualization Uptime
Hister Private full-text search for visited pages and files Uptime
Hubble Cilium network flow & policy-verdict UI (admins, via Authentik) Uptime
homelable Homelab topology map (external host, proxied via ingress) —
homepage Central start page / service dashboard Uptime
homer Static services dashboard Uptime
immich Self-hosted photo & video backup Uptime
immich-power-tools Bulk management add-on for Immich —
IT-Tools Developer utilities (via Authentik proxy) Uptime
jellyfin Movie & TV media server Uptime
kavita Ebook, comic & manga reader Uptime
kite Kubernetes web dashboard Uptime
linkding Minimal bookmark manager Uptime
n8n Workflow automation & integrations Uptime
navidrome Music library server (Subsonic/OpenSubsonic API), feeds Music Assistant Uptime
nextcloud File sync, share & collaboration Uptime
Outline Team wiki & knowledge base Uptime
paperless-gpt LLM-based OCR, titling & tagging for paperless-ngx —
paperless-ngx Document management with OCR & archiving Uptime
readeck Read-it-later & web article archive Uptime
searxng Privacy-respecting metasearch engine Uptime
SparkyFitness Fitness & nutrition tracker Uptime
SpectrumKNX KNX bus monitor for smart-home Uptime
Stirling-PDF Browser-based PDF toolbox Uptime
tandoor Recipe manager & meal planner Uptime
teslamate Tesla data logger & analytics Uptime
VictoriaMetrics Metrics storage & alerting backend Uptime
Vikunja Tasks & tickets, recurring chores Uptime
watchyourlan LAN device discovery & monitoring Uptime
workshops Static workshop pages, synced from Git —

Infrastructure Principles

1. Dependency Management

Standard tools (Helm charts, Docker images) are managed by Renovate. GitHub is the primary source of truth.

2. Networking

Talos nodes run Cilium (VXLAN tunnel, kube-proxy kept), which also enforces the NetworkPolicies (docs/runbooks/cilium.md, docs/runbooks/network-policies-rollout.md). Hubble shows every flow at hubble.cluster.f4mily.net (Authentik, admins only). Ingress is handled by the NGINX Ingress Controller. SSL certificates are automated via cert-manager (Let's Encrypt).

3. Persistence Strategy

Storage is matched to each workload's own replication model — not a one-size-fits-all default.

  • Databases — node-local local-path (NOT iSCSI): CloudNativePG (PostgreSQL) clusters run on per-node local-path storage. CNPG replicates at the database layer (3 instances + continuous S3/barman backups), so node-local disks are both faster and keep the shared-NAS single point of failure out of the database path. This is the CNPG-recommended pattern; the previous setup ran every DB on one TrueNAS iSCSI target, which repeatedly cascaded (a single iSCSI blip → WAL corruption → cluster-wide CNPG outage). Provisioner: infrastructure/base/storage/local-path-provisioner/; class local-path (non-default). Backing disk: each node's sdb1, mounted by Talos as ExistingVolumeConfig local-storage at /var/mnt/local-storage (Omni config patch per node).
  • App RWO volumes (iSCSI): Application config/data volumes that have no app-level replication use Democratic CSI on TrueNAS (truenas-iscsi, the default class), backed up via Velero. (Such volumes are better served by replicated storage — Longhorn — than node-pinned local-path; a future improvement.)
  • Mass Storage (NFS): Large media files (Photos, Videos, Books) and bulk document storage.

Migrating a CNPG cluster's storage — a storageClass change applies to new instances only. Roll existing instances one at a time (kubectl -n cnpg-system delete pvc <inst> --wait=false && kubectl -n cnpg-system delete pod <inst>); CNPG re-bootstraps each via pg_basebackup. Wait for N/N healthy between steps; do the primary last (brief failover).

4. GitOps (FluxCD)

Flux reconciles the cluster state against the GitHub repository. Changes are applied via PRs to the main branch.


Repository Structure

homelab-gitops/
├── clusters/                # Flux entry points
│   └── main/                # Production cluster config
├── infrastructure/          # Cluster-wide components
│   ├── base/                # Shared sources
│   │   ├── storage/         # local-path (CNPG) + iSCSI (democratic-csi) + NFS PVs
│   │   ├── database/        # CloudNativePG operator
│   │   └── ...
│   └── overlays/main/       # Cluster patches & secrets
├── apps/                    # Business applications
│   ├── base/                # Generic HelmReleases & manifests
│   └── overlays/main/       # Environment-specific overrides
├── docs/                    # Architecture, runbooks, migrations
└── scripts/                 # Maintenance and CI helpers

Development Environment (Nix Shell)

# Dev shell with just + stack tooling (kubectl, flux, kustomize, sops, ...)
nix develop

# List available tasks
just

Local validation

just validate   # lint + kustomize build + kubeconform + helm template

Run this before every push — it mirrors the PR Validation CI check.


Secrets (SOPS + age)

Secrets are encrypted in-repo with SOPS and an age key; Flux decrypts them in-cluster. Never commit plaintext secrets.

export SOPS_AGE_KEY_FILE=~/.config/sops/age/keys.txt

sops path/to/secret.sops.yaml          # edit an encrypted file
sops --encrypt --in-place secret.yaml  # encrypt a new secret

Bootstrap & Recovery

The cluster is bootstrapped from the sibling homelab-infrastructure repository via OpenTofu (see homelab-infrastructure/talos/). The Terraform module flux.tf performs the Flux bootstrap and seeds the SOPS age secret. After Tofu apply, this repo is the only thing Flux ever needs.

Day-1: bootstrap a fresh cluster

cd ../homelab-infrastructure
nix develop .#talos
cd talos
tofu init && tofu apply        # Creates VMs, applies Talos config, bootstraps Flux
kubectl get nodes              # 3 control planes
flux get kustomizations -A     # All green

Day-2: change something in this repo

nix develop                    # homelab-gitops dev-shell
just validate                  # lint + kustomize + kubeconform + helm template
git commit -am "feat: …" && git push
flux reconcile kustomization apps --with-source   # optional, otherwise 1h interval

Disaster recovery

Full runbook: docs/disaster-recovery/README.md. CNPG S3 restore: docs/disaster-recovery/cnpg-s3-dr.md. Short version: the central PostgreSQL cluster is continuously backed up to S3 (Garage) via Barman. The disaster-recovery overlay rehydrates the cluster from S3 on a fresh deploy.


Governance

  1. GitHub is leading: Always push to GitHub. Forgejo is a local mirror.
  2. Surgical changes: Use targeted Kustomize patches instead of duplicating base manifests.
  3. Persistence strategy: Match storage to each workload's replication model (see above).
  4. Security: Secrets are encrypted with SOPS (age). Never commit plaintext secrets.
  5. Automated updates: Let Renovate handle version bumps; manual overrides only when necessary.

Further Documentation

About

Gitops managed homelab applications.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages