Skip to main content
In this guide, you’ll install FluxCD on a single-node Kubernetes cluster running in Docker Desktop (WSL2) using Visual Studio Code. We’ll cover:
  • Installing the Flux CLI
  • Bootstrapping Flux with GitHub
  • Verifying in-cluster components
Ensure you have the following set up:
  • Docker Desktop with Kubernetes enabled (Docker Desktop Docs)
  • kubectl configured
  • A GitHub account
  • Visual Studio Code (or your preferred editor/terminal)

1. Environment Overview

You should see something like this when you open VS Code in WSL2:
The image shows a Visual Studio Code interface with a file explorer on the left and a terminal at the bottom. The terminal is open with a command prompt ready for input.

2. Start a Sample Container

First, launch a test container to ensure Docker is running:

3. Enable Kubernetes in Docker Desktop

Open Docker Desktop settings, navigate to Kubernetes, and enable it:
The image shows the Kubernetes settings page in Docker Desktop, where options to enable Kubernetes, show system containers, and reset the Kubernetes cluster are available.
Verify the single-node cluster is Ready:

4. Install the Flux CLI

Check if Flux is already installed:
Install using the official script:
Expected output:
Confirm the CLI is available:
No server components exist yet:
List current namespaces:

5. Bootstrap Flux on Kubernetes

Flux uses flux bootstrap to install controllers and generate GitOps manifests. The installation docs list several Git providers:
The image shows a webpage from the Flux documentation, specifically the installation section, detailing the bootstrap process for setting up Flux on a Kubernetes cluster. It includes links and instructions for using various Git providers.
In this demo, we’ll use GitHub.

5.1 Create a GitHub Personal Access Token

  1. Go to Developer settingsPersonal access tokensTokens (classic).
  2. Click Generate new token, select repo scope, and create it:
The image shows a GitHub settings page for developer settings, specifically focusing on GitHub Apps and personal access tokens.
The image shows a GitHub settings page for creating a new personal access token, with options to set expiration and select scopes for access permissions.
Store your GitHub token safely. Never commit it to a public repo or share it in plaintext.

5.2 Run flux bootstrap

Export the token and bootstrap Flux to your GitHub repo:
What happens during bootstrap:
  • Flux connects to GitHub and creates (or clones) the repo
  • Component manifests install into the flux-system namespace
  • A deploy key and Kubernetes Secret are created
  • Sync manifests are committed to GitHub
  • Flux controllers reconcile their configuration
On success, you’ll see:
Check your GitHub account for the new repository and the token list:
The image shows a GitHub settings page for personal access tokens, with a token displayed and a dropdown menu open on the right side.

6. Clone and Inspect the Bootstrap Repository

View the GitOps manifests Flux created:
The image shows a GitHub repository page named "block-buster" by user "sidd-harth-2," with options to view code, add files, and a prompt to add a README.
Inside flux-clusters/dev-cluster/flux-system, the gotk-components.yaml contains definitions for the flux-system namespace, CRDs, and controller deployments:

7. Verify In-Cluster Components

Ensure everything is running properly:
Finally, check the versions of the CLI and controllers:

Next Steps

You now have Flux installed and bootstrapped with GitHub. In a future post, we’ll explore how to configure and manage GitOps sync manifests for your applications.

Watch Video

Practice Lab