Welcome to the FluxCD v2 Demo repository for the DevOpsDays Natal event! This project is a practical demonstration of how to use FluxCD v2 for GitOps, showcasing the flux bootstrap process to set up a Kubernetes cluster and manage deployments through Git.
This repository includes:
- FluxCD v2 bootstrap demonstration: Walkthrough of initializing a GitOps pipeline using FluxCD.
- Makefile: Simplifies running necessary commands for cluster setup, tool installation, and Flux bootstrapping.
- Kind cluster configuration: Local Kubernetes setup using kind for development and testing.
Before running the commands in this repository, ensure you have the following:
- Environment Variables:
- GITHUB_USER: Your GitHub username.
- GITHUB_TOKEN: A personal access token with repository access.
- Installed Tools:
- brew: Homebrew for managing dependencies (Only needed if you don't have kind and flux cli installed)
Makefile Automation: The included Makefile automates the following tasks:
- Operating system compatibility checks.
- Installation of required tools (kind and flux).
- Kubernetes cluster creation using kind.
- FluxCD bootstrapping into the cluster with your GitHub repository. GitOps Best Practices: Demonstrates the use of Git as the single source of truth for Kubernetes configurations.
git clone https://github.com/<your-username>/<repository-name>.git
cd <repository-name>
Ensure the following variables are set in your shell:
export GITHUB_USER=<your-github-username>
export GITHUB_TOKEN=<your-github-token>
To run all required steps, use:
make all
This will:
- Check your operating system.
- Verify that Homebrew is installed.
- Install necessary tools (kind and flux).
- Create a Kubernetes cluster using Kind.
- Bootstrap FluxCD in your GitHub repository.
The FluxCD bootstrap process is configured to:
- Use your GitHub username and token.
- Target a repository named devopsdays-natal-fluxcd-demo.
- Set up a GitOps pipeline on the main branch.
The command executed by the Makefile is equivalent to:
flux bootstrap github \
--owner=$GITHUB_USER \
--repository=devopsdays-natal-fluxcd-demo \
--branch=main \
--path=./clusters/devopsdays-natal \
--personal \
kubectl config use-context kind-devopsdays-natal
kubectl get po -A
flux get kustomizations --watch
flux logs --tail=100 -f
Special thanks to the DevOpsDays Natal community for inspiring this demo and advancing the practice of DevOps! 🚀