This repository is managed using GitOps with Flux. The cluster continuously reconciles the state declared in Git with what is running in Kubernetes. You make changes by committing YAML to this repo; Flux applies and keeps the cluster in sync.
At a high level, the flow is:
- You declare desired state as Kubernetes manifests in this repository.
- Flux runs in the cluster and watches this repo.
- Flux reconciles the cluster to match what is in Git.
- Any drift is corrected by Flux, and all changes are auditable in Git history.
Think of Git as the single source of truth, and Flux as the controller that enforces it.
https://fluxcd.io/flux/guides/repository-structure/#repository-structure
This repo follows a Flux monorepo layout with top-level clusters/, and apps organized under apps/:
├── apps
│ ├── base
│ │ └── linkding
│ └── staging
│ └── linkding
├── clusters
│ └── staging
│ └── flux-system
├── docs
└── monitoring
└── controllers
├── base
└── staging
The flux-system manifests are generated and managed by Flux. Do not edit them by hand.
Flux is installed into the cluster using flux bootstrap. This does two things:
- Installs the Flux controllers in the
flux-systemnamespace. - Commits the Flux system manifests back into this repo so Flux can manage itself.
Example flow:
- Create a GitHub repo (this repo).
- Create a GitHub personal access token (classic) with
reposcope. - Export credentials for Flux:
export GITHUB_TOKEN=...your-token...
export GITHUB_USER=your-github-username
- Bootstrap Flux:
flux bootstrap github \
--owner="${GITHUB_USER}" \
--repository="home-lab-kubernetes" \
--branch="main" \
--path="clusters/staging" \
--personal
Flux will commit the clusters/staging/flux-system files and begin reconciling.
- Add or update manifests under
clusters/<cluster>/orclusters/<cluster>/apps/. - Commit and push changes to Git.
- Flux detects the change and reconciles the cluster.
If you need to verify:
flux check
flux get kustomizations
kubectl get pods -n flux-system
- Do not manually edit
flux-systemmanifests; Flux owns them. - Use Git history as your audit log.
- Keep changes small and frequent; reconciliation is continuous.