GitOps starter for multi-tenant Kubernetes cluster management with Flux v2
Top 58.0% on SourcePulse
This repository provides a foundational structure and guidance for managing multi-tenant Kubernetes clusters using Flux v2. It targets platform administrators and tenant developers, enabling automated, GitOps-driven application deployment and lifecycle management for isolated tenant environments.
How It Works
The solution leverages Flux v2's GitOps capabilities to manage both cluster-wide infrastructure and tenant-specific deployments. A platform admin repository defines cluster configurations, infrastructure components (like Kyverno for policy enforcement), and tenant onboarding manifests. Tenant repositories contain application manifests, managed by Flux via GitRepository
and Kustomization
resources. Key to multi-tenancy is the use of dedicated service accounts and role bindings for each tenant, enforced by Flux's lockdown features and optional Kyverno policies to restrict cross-namespace references and remote Kustomize bases.
Quick Start & Requirements
kubectl
, Git, GitHub account, and a Kubernetes cluster.flux bootstrap github
command, pointing to your forked repository and cluster context. Example: flux bootstrap github --context=your-staging-context --owner=${GITHUB_USER} --repository=${GITHUB_REPO} --branch=main --personal --path=clusters/staging
.flux create tenant
and flux create source git
/kustomization
commands to define tenant resources.podinfo
application.kubeconform
) and end-to-end testing with Kind.Highlighted Details
dependsOn
feature.Maintenance & Community
This repository is part of the Flux project, a CNCF graduated project. Development is driven by the Flux community. Further details on community channels and roadmaps can be found on the main FluxCD website.
Licensing & Compatibility
The project is licensed under the Apache License 2.0. This permissive license allows for commercial use and integration with closed-source applications.
Limitations & Caveats
The provided setup assumes a specific Git repository structure and relies heavily on Flux v2's core controllers. While it offers robust multi-tenancy features, platform administrators must carefully configure service account permissions and potentially implement additional validation webhooks (e.g., via Kyverno or OPA Gatekeeper) to enforce mandatory serviceAccountName
fields for tenant resources.
6 days ago
1 day