Skip to content

Flux

Archived

This page has been archived and kept for reference. Some of the links on this page may no longer work.

FluxCD is deployed on my Talos Kubernetes node to adopt a GitOps approach to deploying applications on Kubernetes. My GitHub repository is the source of truth for Kubernetes applications I have deployed.

What is GitOps?

GitOps is a way of managing your infrastructure and applications so that whole system is described declaratively and version controlled (most likely in a Git repository), and having an automated process that ensures that the deployed environment matches the state specified in a repository.

Source.

Prerequisite

Install the flux CLI:

brew install fluxcd/tap/flux

Deploying the Flux Controllers

  1. Export the GitHub PAT:

    export GITHUB_TOKEN=<Insert token here>
    
  2. Deploy the Flux controllers:

    flux bootstrap github \
        --token-auth \
        --cluster-domain=cluster.net.dbren.uk \
        --owner=dbrennand \
        --repository=home-ops \
        --branch=main \
        --path=kubernetes/flux \
        --personal
    
  3. Verify that the Flux controllers are reconciled and deployed successfully:

    flux check
    

Upgrading Flux

  1. Upgrade the flux CLI:

    brew install fluxcd/tap/flux
    
  2. Update the Flux manifest:

    flux install --export > ./kubernetes/flux/flux-system/gotk-components.yaml
    
  3. Commit and push the changes:

    git add ./kubernetes/flux/flux-system/gotk-components.yaml
    git push
    
  4. Force flux to upgrade immediately:

    flux reconcile ks flux-system --with-source