$ run as a normal user# run as root (or with sudo)
Bootstrap Flux
One command installs Flux, creates (or uses) a repository, and commits the Flux manifests into it.
curl -s https://fluxcd.io/install.sh | sudo bash
export GITHUB_TOKEN=ghp_...
flux check --pre
flux bootstrap github --owner=s0sta --repository=fleet --branch=main --path=clusters/lab --personal
flux check
kubectl get pods -n flux-system| Controller | Job |
|---|---|
| source-controller | Pulls Git repositories, Helm repositories, OCI artifacts |
| kustomize-controller | Applies Kustomize folders |
| helm-controller | Installs and upgrades Helm releases |
| notification-controller | Alerts and incoming webhooks |
| image-automation (optional) | Updates image tags in Git |
Add a source and a Kustomization
A GitRepository tells Flux where to pull; a Kustomization tells it which path to apply, how often, and whether to prune.
flux create source git shop --url=https://github.com/s0sta/shop-deploy --branch=main --interval=1m --export > shop-source.yaml
flux create kustomization shop-prod --source=GitRepository/shop --path=./overlays/prod --prune=true --interval=5m --target-namespace=shop-prod --export > shop-kustomization.yaml
git add . && git commit -m "Add shop to Flux" && git push
flux get sources git
flux get kustomizationsInstall charts with HelmRelease
A HelmRepository source plus a HelmRelease with values.
ingress-nginx.yaml
apiVersion: source.toolkit.fluxcd.io/v1
kind: HelmRepository
metadata: { name: ingress-nginx, namespace: flux-system }
spec:
interval: 1h
url: https://kubernetes.github.io/ingress-nginx
---
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata: { name: ingress-nginx, namespace: ingress-nginx }
spec:
interval: 10m
chart:
spec:
chart: ingress-nginx
version: "4.11.x"
sourceRef: { kind: HelmRepository, name: ingress-nginx, namespace: flux-system }
values:
controller:
replicaCount: 2Operate Flux
Force a sync, pause, and read events.
flux reconcile kustomization shop-prod --with-source
flux suspend kustomization shop-prod
flux resume kustomization shop-prod
flux logs --level=error
flux events
flux tree kustomization shop-prodRemember
suspend is the emergency brake: Flux stops changing that part, so you can investigate. Always resume (and fix Git) afterwards.