State/Version: 20240225
Installing and Configuring 🏷️FluxCD is the easy part ( if you do not mess up your dns setup :] ).
This will install Flux into the cluster and connect it to the specified git repository. You have to repeat it for every cluster you want to manage.
export GITHUB_TOKEN=<PersonalAccessToken>
export GITHUB_USER=gerundium
flux bootstrap github \
--token-auth \
--owner=gerundium \
--repository=flux-k2 \
--path=clusters/<STAGE> \
--personal \
--branch main
At this point your fluxcd is authorized and configured to apply changes (pull-based), that are stored in your 🏷️github-repository, to the Kubernetes cluster.
I am convinced that a everything(possible) as code is an absolut must have in a homelab.
Furthermore using a standarized toolstack makes it possible to share your insights and issues with a wide community.
This screenshot shows some statistics for the current setup:
The filestructure looks like this.:
.
├── apps
│ [...]
│ ├── base
│ │ ├── cloudflared
│ │ │ ├── deployment.yaml
│ │ │ └── tunnel-credentials-sealed.yaml
│ │ ├── homer
│ │ │ ├── helmRepo.yaml
│ │ │ ├── kustomization.yaml
│ │ │ └── namespace.yaml
│ │ ├── mysql-operator
│ │ │ ├── helmRepo.yaml
│ │ │ ├── kustomization.yaml
│ │ │ └── namespace.yaml
│ │ ├── nginx
│ │ │ ├── configmap.yaml
│ │ │ ├── deployment.yaml
│ │ │ ├── kustomization.yaml
│ │ │ ├── namespace.yaml
│ │ │ └── service.yaml
│ │ └── openproject
│ │ ├── helmRepo.yaml
│ │ ├── kustomization.yaml
│ │ └── namespace.yaml
│ ├── dev
│ │ ├── cloudflared-broken
│ │ │ ├── helmRelease.yaml
│ │ │ ├── helmRepository.yaml
│ │ │ └── namespace.yaml
│ │ ├── homer
│ │ │ ├── certificate.yaml
│ │ │ ├── config-secret-sealed.yaml
│ │ │ ├── config-secret.yaml
│ │ │ ├── helmRelease.yaml
│ │ │ ├── ingressroute.yaml
│ │ │ ├── kustomization.yaml
│ │ │ ├── pvc.yaml
│ │ │ └── README.md
│ │ ├── mysql-innodbcluster
│ │ │ ├── clusterSecret.yaml
│ │ │ ├── kustomization.yaml
│ │ │ └── manifest.yaml
│ │ ├── mysql-operator
│ │ │ ├── helmRelease.yaml
│ │ │ ├── kustomization.yaml
│ │ │ └── README.md
│ │ ├── nextcloud
│ │ │ ├── certificate.yaml
│ │ │ ├── helmRelease.yaml
│ │ │ ├── helmRepo.yaml
│ │ │ ├── ingressroute.yaml
│ │ │ ├── ingress.yaml.disable
│ │ │ ├── kustomization.yaml
│ │ │ ├── namespace.yaml
│ │ │ ├── nextcloud-config-source.yaml
│ │ │ └── pvc.yaml
│ │ ├── nextcloud-aio
│ │ │ ├── helmRelease.yaml
│ │ │ ├── helmRepo.yaml
│ │ │ ├── kustomization.yaml
│ │ │ ├── namespace.yaml
│ │ │ ├── nextcloud-config-source.yaml
│ │ │ └── pvc.yaml
│ │ ├── nginx
│ │ │ ├── certificate.yaml
│ │ │ ├── ingressroute.yaml
│ │ │ └── kustomization.yaml
│ │ └── openproject
│ │ ├── certificate.yaml
│ │ ├── helmRelease.yaml
│ │ ├── homer-config-source-sealed.yaml
│ │ ├── homer-config-source.yaml
│ │ ├── ingressroute.yaml
│ │ ├── kustomization.yaml
│ │ ├── pvc.yaml
│ │ └── README.md
│ ├── prod
│ │ ├── nextcloud
│ │ │ ├── helmRelease.yaml
│ │ │ ├── helmRepo.yaml
│ │ │ ├── kustomization.yaml
│ │ │ ├── namespace.yaml
│ │ │ ├── nextcloud-config-source.yaml
│ │ │ └── pvc.yaml
│ │ └── nginx
│ │ ├── flux-patch.yaml
│ │ └── kustomization.yaml
│ └── staging
│ └── nginx
│ ├── certificate.yaml
│ ├── flux-patch.yaml
│ ├── ingressroute.yaml
│ └── kustomization.yaml
├── clusters
│ [...]
│ ├── dev
│ │ ├── apps-dev-homer.yaml
│ │ ├── apps-dev-mysql-innodbcluster.yaml.disable
│ │ ├── apps-dev-mysql-operator.yaml.disable
│ │ ├── apps-dev-nextcloud-aio.yaml.disable
│ │ ├── apps-dev-nextcloud.yaml.disable
│ │ ├── apps-dev-nginx.yaml
│ │ ├── apps-dev-openproject.yaml.disable
│ │ ├── flux-system
│ │ │ ├── gotk-components.yaml
│ │ │ ├── gotk-sync.yaml
│ │ │ └── kustomization.yaml
│ │ ├── infrastructure-base-controllers.yaml
│ │ ├── infrastructure-dev-configs-post.yaml
│ │ ├── infrastructure-dev-configs-pre.yaml
│ │ ├── infrastructure-dev-controllers.yaml
│ │ ├── infrastructure-dev-integration.yaml
│ │ └── infrastructure-dev-secrets.yaml
│ ├── prod
│ │ ├── apps-base-cloudflared.yaml
│ │ ├── apps-prod-nextcloud.yaml
│ │ ├── apps-prod-nginx.yaml
│ │ ├── flux-system
│ │ │ ├── gotk-components.yaml
│ │ │ ├── gotk-sync.yaml
│ │ │ └── kustomization.yaml
│ │ ├── infrastructure-base.yaml
│ │ └── infrastructure-prod.yaml
│ └── staging
│ ├── apps-staging-nginx.yaml
│ ├── flux-system
│ │ ├── gotk-components.yaml
│ │ ├── gotk-sync.yaml
│ │ └── kustomization.yaml
│ ├── infrastructure-base.yaml
│ └── infrastructure-staging.yaml
├── infrastructure
│ [...]
│ ├── base
│ │ └── controllers
│ │ ├── cert-manager.yaml
│ │ ├── kustomization.yaml
│ │ └── sealed-secrets.yaml
│ ├── dev
│ │ ├── configsPost
│ │ │ ├── certManager
│ │ │ ├── kustomization.yaml
│ │ │ └── metallb
│ │ ├── configsPre
│ │ │ ├── kustomization.yaml
│ │ │ ├── nfsProvisioner
│ │ │ └── traefik
│ │ ├── controllersPhase1
│ │ │ ├── kustomization.yaml
│ │ │ └── metallb
│ │ ├── controllersPhase2
│ │ │ ├── kustomization.yaml
│ │ │ └── traefik.yaml
│ │ ├── integration
│ │ │ ├── kustomization.yaml
│ │ │ └── nfs-provisioner.yaml
│ │ └── secrets
│ │ ├── cert-manager
│ │ ├── kustomization.yaml
│ │ └── private.key
│ ├── prod
│ │ ├── configs
│ │ │ ├── cert-manager
│ │ │ └── kustomization.yaml
│ │ ├── controllers
│ │ │ └── kustomization.yaml
│ │ └── secrets
│ │ ├── cert-manager
│ │ └── kustomization.yaml
│ └── staging
│ ├── configs
│ │ ├── cert-manager
│ │ ├── kustomization.yaml
│ │ ├── metallb-ipaddresspool.yaml
│ │ └── traefik
│ ├── controllers
│ │ ├── kustomization.yaml
│ │ ├── longhorn.yaml
│ │ ├── metallb.yaml
│ │ └── traefik.yaml
│ └── secrets
│ ├── cert-manager
│ ├── kustomization.yaml
├── public
│ ├── [...]
│ │ └── acebox2-pub-sealed-secrets.pem
│ ├── dev
│ │ └── dev-pub-sealed-secrets.pem
│ └── staging
│ └── staging-pub-sealed-secrets.pem
├── secrets
│ └── bootstrap-sealedSecretsMasterKey.yaml
└── [...]