Skip to content

Migrate from Flux v1 to v2

This guide walks you through migrating from Flux v1 to v2. Read the FAQ to find out what differences are between v1 and v2.

Automated image updates

The image automation feature is under development in Flux v2. Please consult the roadmap for more details.

Feature parity

"Feature parity" does not mean Flux v2 works exactly the same as v1 (or is backward-compatible); it means you can accomplish the same results, while accounting for the fact that it's a system with a substantially different design. This may at times mean that you have to make adjustments to the way your current cluster configuration is structured. If you are in this situation and need help, please refer to the support page.


You will need a Kubernetes cluster version 1.16 or newer and kubectl version 1.18 or newer.

Install Flux v2 CLI

With Homebrew:

brew install fluxcd/tap/flux

With Bash:

curl -s | sudo bash

# enable completions in ~/.bash_profile
. <(flux completion bash)

Command-line completion for zsh, fish, and powershell are also supported with their own sub-commands.

Binaries for macOS, Windows and Linux AMD64/ARM are available for download on the release page.

Verify that your cluster satisfies the prerequisites with:

flux check --pre

GitOps migration

Flux v2 offers an installation procedure that is declarative first and disaster resilient.

Using the flux bootstrap command you can install Flux on a Kubernetes cluster and configure it to manage itself from a Git repository. The Git repository created during bootstrap can be used to define the state of your fleet of Kubernetes clusters.

For a detailed walk-through of the bootstrap procedure please see the installation guide.

flux bootstrap target

flux bootstrap should not be run against a Git branch or path that is already being synchronized by Flux v1, as this will make them fight over the resources. Instead, bootstrap to a new Git repository, branch or path, and continue with moving the manifests.

After you've installed Flux v2 on your cluster using bootstrap, you can delete the Flux v1 from your clusters and move the manifests from the Flux v1 repository to the bootstrap one.

In-place migration


For production use we recommend using the bootstrap procedure (see the Gitops migration section above), but if you wish to install Flux v2 in the same way as Flux v1 then follow along.

Flux read-only mode

Assuming you've installed Flux v1 to sync a directory with plain YAMLs from a private Git repo:

# create namespace
kubectl create ns flux

# deploy Flux v1
fluxctl install \ \
--git-branch=main \
--git-path=./deploy \
--git-readonly \
--namespace=flux | kubectl apply -f -

# print deploy key
fluxctl identity --k8s-fwd-ns flux

# trigger sync
fluxctl sync --k8s-fwd-ns flux

Uninstall Flux v1

Before you proceed, scale the Flux v1 deployment to zero or delete its namespace and RBAC.

If there are YAML files in your deploy dir that are not meant to be applied on the cluster, you can exclude them by placing a .sourceignore in your repo root:

$ cat .sourceignore
# exclude all
# include deploy dir
# exclude files from deploy dir

Install Flux v2 in the flux-system namespace:

$ flux install \
  --network-policy=true \
  --watch-all-namespaces=true \
✚ generating manifests
✔ manifests build completed
► installing components in flux-system namespace
✔ install completed
◎ verifying installation
✔ source-controller ready
✔ kustomize-controller ready
✔ helm-controller ready
✔ notification-controller ready
✔ install finished

Register your Git repository and add the deploy key with read-only access:

$ flux create source git app \
  --url=ssh:// \
  --branch=main \
► generating deploy key pair
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCp2x9ghVmv1zD...
Have you added the deploy key to your repository: y
► collecting preferred public key from SSH server
✔ collected public key from SSH server: ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A...
► applying secret with keys
✔ authentication configured
✚ generating GitRepository source
► applying GitRepository source
✔ GitRepository source created
◎ waiting for GitRepository source reconciliation
✔ GitRepository source reconciliation completed
✔ fetched revision: main/5302d04c2ab8f0579500747efa0fe7abc72c8f9b

Configure the reconciliation of the deploy dir on your cluster:

$ flux create kustomization app \
  --source=app \
  --path="./deploy" \
  --prune=true \
✚ generating Kustomization
► applying Kustomization
✔ Kustomization created
◎ waiting for Kustomization reconciliation
✔ Kustomization app is ready
✔ applied revision main/5302d04c2ab8f0579500747efa0fe7abc72c8f9b

If your repository contains secrets encrypted with Mozilla SOPS, please read this guide.

Pull changes from Git and apply them immediately:

flux reconcile kustomization app --with-source 

List all Kubernetes objects reconciled by app:

kubectl get all --all-namespaces \ \

Flux with Kustomize

Assuming you've installed Flux v1 to sync a Kustomize overlay from an HTTPS Git repository:

fluxctl install \
--git-url= \
--git-branch=main \
--manifest-generation \
--namespace=flux | kubectl apply -f -

With the following .flux.yaml in the root dir:

version: 1
    - command: kustomize build ./overlays/prod
  patchFile: flux-patch.yaml

Uninstall Flux v1

Before you proceed, delete the Flux v1 namespace and remove the .flux.yaml from your repo.

Install Flux v2 in the flux-system namespace:

flux install

Register the Git repository using a personal access token:

flux create source git app \
  --url= \
  --branch=main \
  --username=git \
  --password=token \

Configure the reconciliation of the prod overlay on your cluster:

flux create kustomization app \
  --source=GitRepository/app \
  --path="./overlays/prod" \
  --prune=true \

Check the status of the Kustomization reconciliation:

$ flux get kustomizations app
NAME    REVISION                                        SUSPENDED   READY
app     main/5302d04c2ab8f0579500747efa0fe7abc72c8f9b   False       True

Flux with Slack notifications

Assuming you've configured Flux v1 to send notifications to Slack with FluxCloud.

With Flux v2, create an alert provider for a Slack channel:

flux create alert-provider slack \
  --type=slack \
  --channel=general \

And configure notifications for the app reconciliation events:

flux create alert app \
  --provider-ref=slack \
  --event-severity=info \
  --event-source=GitRepository/app \

For more details, read the guides on how to configure notifications and webhooks.

Flux debugging

Check the status of Git operations:

$ kubectl -n flux-system get gitrepositories
NAME    READY   MESSAGE                                                                                                                                                                                        
app     True    Fetched revision: main/5302d04c2ab8f0579500747efa0fe7abc72c8f9b                                                                                                                                 
test    False   SSH handshake failed: unable to authenticate, attempted methods [none publickey]

Check the status of the cluster reconciliation with kubectl:

$ kubectl -n flux-system get kustomizations
app    True    Applied revision: main/5302d04c2ab8f0579500747efa0fe7abc72c8f9
test   False   The Service 'backend' is invalid: spec.type: Unsupported value: 'Ingress'

Suspend a reconciliation:

$ flux suspend kustomization app
► suspending kustomization app in flux-system namespace
✔ kustomization suspended

Check the status with kubectl:

$ kubectl -n flux-system get kustomization app
app    False   Kustomization is suspended, skipping reconciliation

Resume a reconciliation:

$ flux resume kustomization app
► resuming Kustomization app in flux-system namespace
✔ Kustomization resumed
◎ waiting for Kustomization reconciliation
✔ Kustomization reconciliation completed
✔ applied revision main/5302d04c2ab8f0579500747efa0fe7abc72c8f9b