Course contentsShow
← Cloud and Infrastructure
Lesson 1930 of 2,98941. FluxFree lesson

Flux Multi-Tenancy Patterns

Implement tenant isolation using namespaces, service accounts, and separate Kustomization resources per team.

Flux Multi-Tenancy Patterns

What You'll Learn

You'll learn how to isolate different teams or tenants in a shared Flux-managed Kubernetes cluster using namespaces, service accounts, and separate Kustomization resources.

Why Multi-Tenancy Matters

When multiple teams share a single Kubernetes cluster with Flux, you need tenant isolation to prevent one team from accidentally (or intentionally) modifying another team's workloads. Think of it like apartment buildings: each tenant gets their own space with locked doors, even though they share the same infrastructure.

Core Multi-Tenancy Components

Namespaces for Isolation

Each team gets dedicated Kubernetes namespaces. Team A's applications live in team-a-namespace, Team B's in team-b-namespace. This provides resource boundaries and prevents naming conflicts.

Service Accounts per Team

Create separate service accounts for each team's Flux controllers. Each service account gets RBAC permissions scoped only to their namespaces. This ensures Team A's Flux components can't touch Team B's resources.

Separate Kustomization Resources

Each team maintains their own Kustomization resource pointing to their Git repository path or folder:

apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
  name: team-a-apps
  namespace: flux-system
spec:
  serviceAccountName: team-a-sa
  targetNamespace: team-a-namespace
  sourceRef:
    kind: GitRepository
    name: main-repo
  path: ./teams/team-a

Each Kustomization explicitly defines which service account and target namespace to use, enforcing boundaries at the Flux level.

The Pattern in Practice

Combine all three: Team A's Kustomization uses team-a-sa service account (bound to team-a-namespace only) and deploys manifests from ./teams/team-a into their isolated namespace. Team B follows the same pattern with their own credentials and paths.

Key Takeaway: Flux multi-tenancy relies on namespace isolation, scoped service accounts with RBAC, and separate Kustomization resources per team to enforce safe, isolated GitOps workflows in shared clusters.