Prerequisites
Before you begin, ensure:- Your Kubernetes version is 1.20.6 or newer.
kubectlis configured to communicate with your target cluster.
Using End-of-Life (EOL) Kubernetes versions in production is not recommended. Upgrade your cluster if you’re on a version older than v1.20.6.
1. Install the Flux CLI
FluxCD is managed via its command-line interface. Download precompiled binaries from GitHub for macOS, Linux, and Windows.| Operating System | Install Command | Reference |
|---|---|---|
| Linux | curl -s https://fluxcd.io/install.sh | sudo bash | FluxCD Install Script |
| macOS | brew install fluxcd/tap/flux | Homebrew FluxCD Tap |
| Windows | scoop install fluxcd or choco install fluxcd | FluxCD Releases |
Running the install script (
install.sh) automatically places the flux binary in your $PATH.2. Bootstrap Flux with Git
Useflux bootstrap to initialize FluxCD in your cluster and configure it to manage itself from a Git repository. The command supports multiple Git providers:
| Git Provider | Flag | Example |
|---|---|---|
| GitHub | --owner | flux bootstrap github … |
| GitLab | --owner | flux bootstrap gitlab … |
| Bitbucket | --owner | flux bootstrap bitbucket … |
| Azure DevOps | --owner | flux bootstrap azure --organization your-org |
| AWS CodeCommit | --owner | flux bootstrap aws --region us-west-2 |
- Prompt for your GitHub Personal Access Token (PAT).
- Create the specified repository if it doesn’t exist.
- Generate FluxCD component manifests.
- Commit and push manifests to your Git branch and path.
- Create the
flux-systemnamespace in your cluster and install Flux controllers. - Generate an SSH keypair, store it as a Kubernetes secret, and add it as a deploy key to the repo.
- Synchronize and begin reconciling resources.
The
bootstrap command is idempotent—running it multiple times will not change an already-bootstraped setup.3. Inspect Your Git Repository
After bootstrapping, clone your repo to review the FluxCD configuration and any starter workloads:flux-clusters/dev-cluster/apps/ will automatically trigger reconciliation.
4. Customizing Flux Components
You can tailor Flux manifests at two stages:- Before bootstrapping:
- Add flags to your
flux bootstrapcommand. - Edit the generated manifests locally and then push to Git.
- Add flags to your
- After bootstrapping:
- Modify YAML files under
flux-systemin your Git repository. - Flux will detect changes and apply them to the cluster automatically.
- Modify YAML files under
5. Alternative Installation Methods
| Method | Description | Link |
|---|---|---|
| Terraform | Bootstrap FluxCD declaratively using Terraform and the Flux provider | Flux Terraform Provider |
| flux install (local only) | Quickly install Flux controllers directly into a cluster without Git integration (ideal for testing or development) | flux install |
6. Uninstalling Flux
To remove Flux controllers and CRDs from your cluster:flux uninstall does not delete Kubernetes objects or Helm releases that Flux managed—those resources remain in your cluster.