Skip to content
Latchkey

How to Bootstrap Flux From CI

flux bootstrap installs the Flux controllers and commits them to Git, so Flux thereafter manages its own upgrades through GitOps.

Run flux bootstrap github with a kubeconfig and a GitHub PAT. It creates or updates the cluster path in your repo, installs the controllers, and configures them to sync that path.

Steps

  • Provide a kubeconfig and a GITHUB_TOKEN with repo scope as secrets.
  • Install the Flux CLI in the job.
  • Run flux bootstrap github with the owner, repo, and path.
  • Flux commits its manifests and starts reconciling.

Workflow

.github/workflows/flux-bootstrap.yml
jobs:
  bootstrap:
    runs-on: ubuntu-latest
    steps:
      - uses: fluxcd/flux2/action@main
      - run: |
          flux bootstrap github \
            --owner=my-org \
            --repository=deploy-config \
            --branch=main \
            --path=clusters/prod \
            --personal=false
        env:
          GITHUB_TOKEN: ${{ secrets.FLUX_GITHUB_TOKEN }}
          KUBECONFIG: ${{ github.workspace }}/kubeconfig

Gotchas

  • Bootstrap is idempotent; re-running it upgrades Flux to the CLI version in use.
  • Use --personal=false for org-owned repos so the deploy key is created correctly.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →