Flux GitOps Stack
Flux CD for GitOps with Weave GitOps UI.
Overview
Flux is a Cloud Native Computing Foundation (CNCF) graduated project that implements GitOps principles for Kubernetes, treating Git repositories as the single source of truth for cluster configuration and application deployment. Originally developed by Weaveworks, Flux automates the deployment process by continuously monitoring Git repositories and synchronizing changes to Kubernetes clusters, eliminating manual kubectl commands and ensuring declarative infrastructure management. Flux CD operates on a pull-based model where controllers running inside the cluster detect configuration drift and automatically reconcile the desired state defined in Git.
This GitOps stack combines Flux CD with Kind (Kubernetes in Docker) for local cluster simulation and Weave GitOps UI for visual management and monitoring. Kind provides a lightweight Kubernetes environment that runs entirely in Docker containers, making it perfect for GitOps development and testing without requiring cloud resources. The integrated container registry enables storing and managing custom images locally, while Weave GitOps delivers a web-based dashboard for visualizing GitOps workflows, monitoring deployments, and troubleshooting synchronization issues across multiple clusters.
This configuration targets DevOps engineers and platform teams implementing GitOps practices in development environments, CI/CD pipelines, or proof-of-concept deployments. The stack eliminates the complexity of setting up separate Kubernetes clusters, Git repositories, and monitoring tools by providing a unified development environment where teams can experiment with GitOps workflows, test Flux configurations, and validate deployment strategies before promoting to production clusters.
Key Features
- Pull-based GitOps reconciliation with Flux controllers monitoring Git repository changes
- Multi-tenancy support with Flux namespace isolation and RBAC integration
- Helm and Kustomize native support for complex application deployment patterns
- Kind cluster with containerd runtime optimized for local Kubernetes development
- Weave GitOps dashboard for visualizing application deployments and Git synchronization status
- Built-in container registry for storing custom images without external dependencies
- Flux image automation for updating container tags based on registry scanning
- Git webhook support for immediate synchronization triggers beyond polling intervals
Common Use Cases
- 1Local GitOps development environment for testing Flux configurations before production deployment
- 2CI/CD pipeline integration for validating GitOps workflows in ephemeral test clusters
- 3Multi-environment application promotion workflows using Git branching strategies
- 4Kubernetes manifest validation and drift detection in containerized development setups
- 5Training and education platform for teams learning GitOps principles and Flux operations
- 6Proof-of-concept deployments demonstrating GitOps benefits to stakeholders and management
- 7Custom controller development and testing in isolated Kubernetes environments
Prerequisites
- Docker Engine 20.10+ with privileged container support for Kind cluster operation
- Git repository with Kubernetes manifests and Flux configuration files
- Minimum 4GB RAM and 2 CPU cores for stable Kind cluster with Flux controllers
- Network access to GitHub/GitLab for Flux source controller Git repository synchronization
- Basic Kubernetes knowledge including pods, services, and namespace concepts
- Understanding of YAML syntax and Kubernetes manifest structure for GitOps workflows
For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms
docker-compose.yml
docker-compose.yml
1services: 2 kind: 3 image: kindest/node:v1.28.04 container_name: flux-cluster5 privileged: true6 ports: 7 - "${API_PORT:-6443}:6443"8 volumes: 9 - kind_data:/var/lib/containerd1011 registry: 12 image: registry:213 container_name: flux-registry14 restart: unless-stopped15 ports: 16 - "${REGISTRY_PORT:-5000}:5000"17 volumes: 18 - registry_data:/var/lib/registry1920 weave-gitops: 21 image: ghcr.io/weaveworks/wego-app:latest22 container_name: weave-gitops23 restart: unless-stopped24 ports: 25 - "${GITOPS_PORT:-9001}:9001"2627volumes: 28 kind_data: 29 registry_data: .env Template
.env
1# Flux GitOps2API_PORT=64433REGISTRY_PORT=50004GITOPS_PORT=90015GITHUB_TOKEN=your_github_tokenUsage Notes
- 1Weave GitOps UI at http://localhost:9001
- 2Bootstrap Flux with flux CLI
- 3Point Flux to your Git repo
Individual Services(3 services)
Copy individual services to mix and match with your existing compose files.
kind
kind:
image: kindest/node:v1.28.0
container_name: flux-cluster
privileged: true
ports:
- ${API_PORT:-6443}:6443
volumes:
- kind_data:/var/lib/containerd
registry
registry:
image: registry:2
container_name: flux-registry
restart: unless-stopped
ports:
- ${REGISTRY_PORT:-5000}:5000
volumes:
- registry_data:/var/lib/registry
weave-gitops
weave-gitops:
image: ghcr.io/weaveworks/wego-app:latest
container_name: weave-gitops
restart: unless-stopped
ports:
- ${GITOPS_PORT:-9001}:9001
Quick Start
terminal
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 kind:5 image: kindest/node:v1.28.06 container_name: flux-cluster7 privileged: true8 ports:9 - "${API_PORT:-6443}:6443"10 volumes:11 - kind_data:/var/lib/containerd1213 registry:14 image: registry:215 container_name: flux-registry16 restart: unless-stopped17 ports:18 - "${REGISTRY_PORT:-5000}:5000"19 volumes:20 - registry_data:/var/lib/registry2122 weave-gitops:23 image: ghcr.io/weaveworks/wego-app:latest24 container_name: weave-gitops25 restart: unless-stopped26 ports:27 - "${GITOPS_PORT:-9001}:9001"2829volumes:30 kind_data:31 registry_data:32EOF3334# 2. Create the .env file35cat > .env << 'EOF'36# Flux GitOps37API_PORT=644338REGISTRY_PORT=500039GITOPS_PORT=900140GITHUB_TOKEN=your_github_token41EOF4243# 3. Start the services44docker compose up -d4546# 4. View logs47docker compose logs -fOne-Liner
Run this command to download and set up the recipe in one step:
terminal
1curl -fsSL https://docker.recipes/api/recipes/flux-gitops-stack/run | bashTroubleshooting
- Flux source controller fails to clone repository: Verify Git credentials and repository URL in Flux GitRepository resource, check network connectivity to Git provider
- Kind cluster fails to start with 'failed to create cluster': Ensure Docker daemon is running with privileged container support and sufficient disk space available
- Weave GitOps UI shows empty clusters: Run 'flux bootstrap' command to install Flux controllers and configure Git repository connection properly
- Kustomization reconciliation suspended with authentication errors: Generate and configure deploy keys or personal access tokens with appropriate repository permissions
- Container registry push failures: Verify registry service is running on port 5000 and Docker daemon trusts localhost:5000 as insecure registry
- Flux controllers consuming high CPU: Reduce Git polling frequency in source controller configuration and optimize Kustomization resource specifications
Community Notes
Loading...
Loading notes...
Download Recipe Kit
Get all files in a ready-to-deploy package
Includes docker-compose.yml, .env template, README, and license
Ad Space
Shortcuts: C CopyF FavoriteD Download