GitOps with FluxCD
This guide shows how to enable GitOps deployments managed by Flux.
Prerequisites
- K3s cluster installed (see
scripts/install-k3s.sh) kubectlaccess- DNS and cert-manager configured
- Git repository accessible to the cluster
Bootstrap Flux
# From repo root
export REPO_URL=https://github.com/dine-together/k8s-infrastructure
export REPO_BRANCH=main
export CLUSTER_ENV=staging # or production
bash k8s-infrastructure/scripts/bootstrap-flux.sh
Repository Layout
k8s-infrastructure/
clusters/
staging/
kustomization.yaml # points to infra components to deploy in staging
production/
kustomization.yaml # points to infra components to deploy in production
monitoring/
kustomization.yaml # Prometheus, Loki, Grafana, exporters
Adding a New App (Helm recommended)
- Create a Helm chart (or reuse a golden chart) for your app.
- Commit a
HelmReleaseunderclusters/<env>/apps/<app>/helmrelease.yaml. - Flux will reconcile and deploy automatically.
Observability
- Monitoring stack is managed under
monitoring/via Kustomize. - Access Grafana at
https://grafana.staging.dinetogether.co.uk(change for production).