Stage 14, Part 1 of 9, Multi-Cluster & Platform Engineering

Text

PART 1: CORE THEORY

1. The Multi-Cluster Imperative

Single clusters don't scale indefinitely. Organizations adopt multi-cluster architectures for isolation, resilience, cost optimization, and regulatory compliance. But multi-cluster introduces complexity that single clusters never had.

Why Organizations Go Multi-Cluster

DriverDescription
IsolationSeparate prod/staging/dev, separate teams, separate customers
ResilienceSurvive zone, region, or provider failures
ComplianceData residency (EU data stays in EU)
ScaleBeyond 1,000–5,000 nodes per cluster
CostOptimize by region or provider
AcquisitionIntegrating acquired companies with their clusters

The Hidden Costs

CostDescription
Operational overheadN clusters × (upgrades + monitoring + backup + cert rotation)
Observability fragmentationMetrics, logs, traces scattered
Policy driftClusters configured differently
Networking complexityCross-cluster service discovery
Security surfaceMore control planes to secure
Cost trackingHarder to allocate spend

The Platform Engineering Response

Platform Engineering is the discipline of building internal developer platforms (IDPs) that make multi-cluster Kubernetes manageable. It treats the platform as a product, with developers as customers.

Traditional OpsPlatform Engineering
Tickets for infrastructureSelf-service
Manual provisioningGolden paths
Per-team toolingStandardized platform
ReactiveProactive

2. The Ownership Levels Framework

Multi-cluster and multi-tenancy decisions can be organized into four ownership levels. Understanding where you sit determines which tools to use.

The Four Levels

LevelWhat You OwnTools
Level 1: Multi-ClusterCluster lifecycle, provisioningCluster API, Terraform
Level 2: Multi-TenancyTenant isolation within a clustervCluster, Capsule, namespaces
Level 3: Platform EngineeringDeveloper experience, self-serviceBackstage, Crossplane
Level 4: GovernancePolicy, compliance, costKyverno, OPA, Kubecost

Why the Framework Matters

Each level has distinct concerns and distinct tools. Confusing them leads to over-engineering (using vCluster when namespaces would suffice) or under-engineering (using namespaces when hard isolation is required).


3. vCluster

vCluster creates virtual Kubernetes clusters inside a host cluster. Each vCluster has its own API server, controller manager, and optional scheduler, but shares the host's worker nodes.

How vCluster Works

text
┌─────────────────────────────────────────────────────────────┐
│                    HOST CLUSTER                             │
│                                                             │
│  ┌─────────────────────────────────────────────────────┐   │
│  │  vCluster A (Namespace: vcluster-a)                 │   │
│  │  • Virtual API server (synced to host)              │   │
│  │  • Virtual controller manager                       │   │
│  │  • Virtual scheduler                                │   │
│  │  • Pods run as host pods                            │   │
│  └─────────────────────────────────────────────────────┘   │
│                                                             │
│  ┌─────────────────────────────────────────────────────┐   │
│  │  vCluster B (Namespace: vcluster-b)                 │   │
│  │  • Virtual API server                               │   │
│  │  • Virtual controller manager                       │   │
│  └─────────────────────────────────────────────────────┘   │
│                                                             │
│  Both share the same host worker nodes.                     │
└─────────────────────────────────────────────────────────────┘

When to Use vCluster

ScenariovCluster?
Development environments✅ Yes
CI/CD pipelines✅ Yes
Multi-team SaaS platforms✅ Yes
Strong tenant isolation✅ Yes
Simple team isolation❌ Use namespaces
Production multi-region❌ Use separate clusters

vCluster Benefits

BenefitDescription
FastCreate virtual clusters in seconds
CheapNo additional nodes
IsolatedEach vCluster has own API server
Self-serviceDevelopers manage their own cluster
Version-skewDifferent vCluster versions on same host

vCluster Limitations

LimitationImpact
No node isolationPods run on shared nodes
CRD conflictsSame CRDs can't be installed twice
Host cluster dependencyvCluster fails if host fails
NetworkingCross-vCluster requires configuration

4. Capsule

Capsule implements Namespace-as-a-Service multi-tenancy. It allows multiple tenants to share a single cluster without giving them cluster-level access.

How Capsule Works

Capsule introduces two CRDs:

CRDPurpose
TenantA tenant with assigned users, groups, and namespaces
TenantResourceQuotaQuota for a tenant

Capsule Architecture

text
┌─────────────────────────────────────────────────────────────┐
│                    SHARED CLUSTER                           │
│                                                             │
│  ┌─────────────────────────────────────────────────────┐   │
│  │  Tenant A (team-a)                                  │   │
│  │  • Users: alice, bob                                │   │
│  │  • Namespaces: team-a-dev, team-a-prod              │   │
│  │  • Quota: 100 CPU, 200 GiB memory                   │   │
│  └─────────────────────────────────────────────────────┘   │
│                                                             │
│  ┌─────────────────────────────────────────────────────┐   │
│  │  Tenant B (team-b)                                  │   │
│  │  • Users: charlie                                   │   │
│  │  • Namespaces: team-b-dev                           │   │
│  │  • Quota: 50 CPU, 100 GiB memory                    │   │
│  └─────────────────────────────────────────────────────┘   │
└─────────────────────────────────────────────────────────────┘

When to Use Capsule

ScenarioCapsule?
Multi-team cluster✅ Yes
Namespace self-service✅ Yes
Quota per tenant✅ Yes
Hard isolation❌ Use vCluster
Single team❌ Use namespaces

5. Cluster API

Cluster API (CAPI) is a Kubernetes sub-project that lets you manage the lifecycle of Kubernetes clusters using Kubernetes itself.

CAPI Architecture

text
┌─────────────────────────────────────────────────────────────┐
│                    MANAGEMENT CLUSTER                       │
│                                                             │
│  ┌─────────────────────────────────────────────────────┐   │
│  │  CAPI Core Controllers                              │   │
│  │  • Cluster, Machine, MachineSet                     │   │
│  └──────────────────────┬──────────────────────────────┘   │
│                         │                                   │
│  ┌──────────────────────▼──────────────────────────────┐   │
│  │  Infrastructure Provider                            │   │
│  │  • AWSCluster, VSphereCluster                       │   │
│  └──────────────────────┬──────────────────────────────┘   │
│                         │                                   │
│  ┌──────────────────────▼──────────────────────────────┐   │
│  │  Bootstrap Provider                                 │   │
│  │  • KubeadmConfig                                    │   │
│  └──────────────────────┬──────────────────────────────┘   │
│                         │                                   │
│  ┌──────────────────────▼──────────────────────────────┐   │
│  │  Control Plane Provider                             │   │
│  │  • KubeadmControlPlane                              │   │
│  └─────────────────────────────────────────────────────┘   │
└─────────────────────────────────────────────────────────────┘

CAPI Resources

ResourcePurpose
ClusterDefines a cluster
MachineRepresents a node
MachineSetGroup of machines
MachineDeploymentDeclarative machine management
KubeadmControlPlaneControl plane management

When to Use CAPI

ScenarioCAPI?
Multi-cloud fleet✅ Yes
On-prem + cloud✅ Yes
Standardized provisioning✅ Yes
Single managed cluster❌ Use managed service

6. Karmada

Karmada (Kubernetes Armada) is a CNCF-graduated project for multi-cluster, multi-cloud Kubernetes orchestration.

Karmada Architecture

ComponentPurpose
Karmada Control PlaneCentral API, scheduler, controllers
Member ClustersWorkload clusters (push or pull mode)
ResourceBindingWorkload distribution decisions
PropagationPolicyWhere workloads should run

Karmada Use Cases

Use CaseDescription
Hybrid cloudRun workloads across AWS, GCP, on-prem
Multi-regionDistribute workloads globally
AI/ML trainingSchedule across GPU clusters
Disaster recoveryActive-active multi-cluster

Karmada v1.19 (2026)

The v1.19 release advances multi-component scheduling for distributed AI training jobs and promotes priority-based scheduling to Beta, enabled by default.


1:1 copy of the class Google Doc, code in code blocks.