Skip to content

GitOps with FluxCD

This guide shows how to enable GitOps deployments managed by Flux.

Prerequisites

  • K3s cluster installed (see scripts/install-k3s.sh)
  • kubectl access
  • 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
  1. Create a Helm chart (or reuse a golden chart) for your app.
  2. Commit a HelmRelease under clusters/<env>/apps/<app>/helmrelease.yaml.
  3. 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).