This is my attempt at documenting my homelab K3S cluster deployment using Flux.
The repo was initialized with k8s@home template. Other sources:
- https://github.com/billimek/k8s-gitops
- https://github.com/onedr0p/home-cluster
- https://github.com/carpenike/k8s-gitops
π Some useful tools used in this project.
Tool | Purpose | Minimum version | Required |
---|---|---|---|
kubectl | Allows you to run commands against Kubernetes clusters | 1.21.0 |
β |
flux | Operator that manages your k8s cluster based on your Git repository | 0.12.3 |
β |
SOPS | Encrypts k8s secrets with GnuPG | 3.7.1 |
β |
GnuPG | Encrypts and signs your data | 2.2.27 |
β |
direnv | Exports env vars based on present working directory | 2.28.0 |
β |
pre-commit | Runs checks during git commit |
2.12.0 |
β |
kustomize | Template-free way to customize application configuration | 4.1.0 |
β |
helm | Manage Kubernetes applications | 3.5.4 |
β |
go-task | A task runner / simpler Make alternative written in Go | 3.7.0 |
β |
prettier | Prettier is an opinionated code formatter. | 2.3.2 |
β |
The Git repository contains the following directories under cluster
and are ordered below by how Flux will apply them.
- base directory is the entrypoint to Flux
- crds directory contains custom resource definitions (CRDs) that need to exist globally in your cluster before anything else exists
- core directory (depends on crds) are important infrastructure applications (grouped by namespace) that should never be pruned by Flux
- apps directory (depends on core) is where your common applications (grouped by namespace) could be placed, Flux will prune resources here if they are not tracked by Git anymore
cluster
βββ apps
β βββ default
β βββ networking
β βββ system-upgrade
βββ base
β βββ flux-system
βββ core
β βββ cert-manager
β βββ metallb-system
β βββ namespaces
β βββ system-upgrade
βββ crds
βββ cert-manager
-
Renovate is a very useful tool that when configured will start to create PRs in your Github repository when Docker images, Helm charts or anything else that can be tracked has a newer version. The configuration for renovate is located here.
-
system-upgrade-controller will watch for new k3s releases and upgrade your nodes when new releases are found.
There's also a couple Github workflows included in this repository that will help automate some processes.
- Flux upgrade schedule - workflow to upgrade Flux.
- Renovate schedule - workflow to annotate
HelmRelease
's which allows Renovate to track Helm chart versions.