Skip to main content
Version: 5.12.0

Flux

Similar to helm, flux provides a client utility which may be used to interact with flux.

curl -LO https://github.com/fluxcd/flux2/releases/download/v0.15.0/flux_0.15.0_linux_amd64.tar.gz
tar -xzvf flux*.tar.gz
alias flux='sudo ./flux --kubeconfig=/etc/rancher/rke2/rke2.yaml'

Common actions and troubleshooting:

# similar to kubectl get hr -A but provides the chart's revision
flux get kustomizations -A
flux get helmreleases -A

# force the source controller to reconcile repo, ks, and hr
flux reconcile source git -n bigbang {{ repo }}
flux reconcile ks -n bigbang {{ kustomization }}
flux reconcile hr -n bigbang {{ helmrelease }}


# troubleshooting
kubectl get helmcharts.source.toolkit.fluxcd.io -A

# check flux component version
flux check

Flux Core Concepts:

  • GitOps: declaratively define infrastructure and applications in version control; target environment should match repo
  • Sources: defines a repository and the requirements to obtain it, such as credentials, tags, etc.
  • Reconciliation: ensures a target's state matches what is defined declaratively in the source (we use Kustomization and HelmReleases)
  • Kustomization: represents a local set of Kubernetes resource, an overlay

Flux GitOps Toolkits:

  • Source controller: provides a common interface for artifact collection and the GitRepository Custom Resource Definition (CRD), which we use frequently
  • Kustomize controller: reconciles the cluster state from multiple sources (i.e., GitRepository) and generates the appropriate manifest for overlays
  • Helm controller: performs Helm actions as described in the CRD HelmRelease
  • Notification controller: handles inbound and outbound events (e.g., GitLab, Jenkins, etc.) and notifies other toolkit components