Kubernetes GitOps with Flux

Published: (December 22, 2025 at 02:45 PM EST)
2 min read
Source: Dev.to

Source: Dev.to

Create a GitHub Personal Access Token

  1. Open a new browser tab and go to github.com.
  2. Sign in (or create a new account).
  3. Click your avatar in the upper‑right corner → Settings.
  4. In the left‑hand menu select Developer settingsPersonal access tokens.
  5. Click Generate a personal access token.
  6. If prompted, re‑enter your password and confirm.
  7. Under Note, enter a descriptive name (e.g., acg-flux-lab).
  8. Under Select scopes, check the repo box.
  9. Click Generate token and copy the generated token.

Token creation screen

Bootstrap the Git Repository

On the lab server, run the following command, replacing “ with your GitHub username:

flux bootstrap github \
  --owner= \
  --repository=acg-flux-lab \
  --branch=main \
  --path=./clusters/my-cluster \
  --personal
  • This creates a new GitHub repository named acg-flux-lab.
  • When prompted, paste the personal access token you generated earlier.

Visit https://github.com//acg-flux-lab to verify that the repository was created.

CLI output after bootstrap
Repository view on GitHub

YAML Manifest

Below is the example manifest that will be added to the repository:

YAML manifest preview

Create a Deployment via the GitHub Repository Using Flux

  1. In the acg-flux-lab repository on GitHub, click Add filesCreate new file.
  2. Set the path to clusters/my-cluster/turtle-deployment.yaml.
  3. Paste the following YAML into the editor:
apiVersion: apps/v1
kind: Deployment
metadata:
  name: turtle-deployment
  namespace: default
spec:
  replicas: 3
  selector:
    matchLabels:
      app: turtle
  template:
    metadata:
      labels:
        app: turtle
    spec:
      containers:
        - name: nginx
          image: nginx:stable
  1. Commit the new file directly to the main branch.

Commit screen

After Flux reconciles the repository, verify the resources:

kubectl get pods
kubectl get deployments

kubectl output

Reference

  • (no items)
Back to Blog

Related posts

Read more »