Flux upgrade

Upgrade the Flux CLI and controllers

Flux can be upgrade from any v2.x release to any other v2.x release (the latest patch version). For more details about supported versions and upgrades please see the Flux release documentation.

Flux CLI upgrade

Running flux check --pre will tell you if a newer Flux version is available.

Update the Flux CLI to the latest release using a package manager or by downloading the binary from GitHub releases.

Verify that you are running the latest version with:

flux --version

Flux controllers upgrade

The Flux controllers have the capability to upgrade themselves if they were installed using the bootstrap procedure.

Upgrade with Git

To upgrade the Flux controllers with Git, you can generate the new Kubernetes manifests using the Flux CLI and push them to the Git repository where bootstrap was run.

Note that this procedure does not require direct access to the Kubernetes cluster where Flux is installed.

Assuming you’ve bootstrapped with --path=/clusters/my-cluster, you can update the manifests in Git with:

git clone https://<git-host>/<org>/<bootstrap-repo>
cd <bootstrap-repo>
flux install --export > ./clusters/my-cluster/flux-system/gotk-components.yaml
git add -A && git commit -m "Update $(flux -v) on my-cluster"
git push

If you’ve enabled extra Flux components at bootstrap, like those required for the image automation feature. Ensure to include these components when generating the components manifest:

flux install \
--components-extra image-reflector-controller,image-automation-controller \
--export > ./clusters/my-cluster/flux-system/gotk-components.yaml

Wait for Flux to detect the changes or, tell it to do the upgrade immediately with:

flux reconcile ks flux-system --with-source

Upgrade with Flux CLI

If you’ve used the bootstrap procedure to deploy Flux, then rerun the bootstrap command for each cluster using the same arguments as before:

flux bootstrap github \
  --owner=my-github-username \
  --repository=my-repository \
  --branch=main \
  --path=clusters/my-cluster \
  --personal

The above command will clone the repository, it will update the components manifest in <path>/flux-system/gotk-components.yaml and it will push the changes to the remote branch.

Verify that the controllers have been upgrade with:

flux check

Upgrade with Terraform

If you’ve used the Terraform Provider to bootstrap Flux, then update the provider to the latest version and run terraform apply.

The upgrade performed with Terraform behaves in the same way as the upgrade with Flux CLI.

Upgrade with kubectl

If you’ve installed Flux directly on the cluster with kubectl, then rerun the command using the latest manifests from GitHub releases page:

kubectl apply --server-side -f https://github.com/fluxcd/flux2/releases/latest/download/install.yaml
Last modified 2023-12-18: fix: typo (0aaa8ce)