Multi-tenancy and multi-cluster
Sharing clusters between teams with namespaces, RBAC, quotas and policy, when virtual or separate clusters are better, and managing many clusters.
Multi-tenancy and multi-cluster
The player loads from youtube-nocookie.com when you press play. Nothing reaches YouTube before that.
Not started
What you'll learn
- A namespace is a scope for names and policy, not an isolation boundary by itself. A tenant needs RBAC, ResourceQuota and LimitRange, NetworkPolicies, Pod Security and admission policy together.
- Soft multi-tenancy suits teams that trust each other. Hostile or regulated tenants need stronger boundaries: sandboxed runtimes, dedicated nodes, virtual clusters or separate clusters.
- Cluster-scoped things (CRDs, ClusterRoles, webhooks, StorageClasses, the API server itself) are shared by every namespace tenant, which is where namespace tenancy runs out.
- Virtual clusters give each tenant its own API server and CRDs inside a shared host cluster's nodes. Isolation of the data plane still depends on the host.
- Many clusters buy blast-radius and version independence at the price of duplicated add-ons and operations. Manage them as a fleet: Cluster API or IaC to create them, GitOps to configure them.
- Cross-cluster traffic and failover need an explicit mechanism, such as global load balancing, the Multi-Cluster Services API or a mesh. Kubernetes doesn't join clusters for you.
Who else is in your cluster?
The first cluster has one team and everyone is an admin. Then a second team arrives, then ten, then a customer-facing product that runs untrusted code. Giving each its own cluster is simple and expensive: every cluster needs its control plane, add-ons, upgrades and on-call. Sharing one is cheap until a team deploys a load test that starves everyone, reads another team’s Secrets, or installs a CRD that breaks someone else’s operator.
Multi-tenancy is the set of controls that let tenants share a cluster safely. Multi-cluster is the choice to not share, and the tooling to manage what results. Most organisations end up doing some of both.
Building a namespace tenant
A namespace on its own isolates almost nothing. A tenant namespace is a bundle of controls, mostly covered earlier in this roadmap. On the lab cluster I gave two teams this:
kubectl create ns tenant-red
kubectl label ns tenant-red tenant=red pod-security.kubernetes.io/enforce=baseline
kubectl -n tenant-red create quota tenant \
--hard=requests.cpu=4,requests.memory=8Gi,pods=20,services.loadbalancers=0
kubectl -n tenant-red create rolebinding devs --clusterrole=edit --group=team-red
Then asked what a team-red member (--as=ruby --as-group=team-red) can do:
create deployments.apps -n tenant-red yes
get secrets -n tenant-blue no
create namespaces no
create resourcequotas -n tenant-red no
delete resourcequotas -n tenant-red no
create rolebindings -n tenant-red no
get nodes no
create customresourcedefinitions no
They work freely in their own namespace and see nothing else. The quota is enforced, not advisory. Creating a LoadBalancer Service was refused: exceeded quota: tenant, requested: services.loadbalancers=1, used: services.loadbalancers=0, limited: services.loadbalancers=0. Note what edit still allows: creating Pods (and so using any Secret or ServiceAccount in the namespace) and impersonating ServiceAccounts there. Don’t put anything in a tenant namespace that its members shouldn’t have.
A full tenant also needs:
- A LimitRange for default requests and limits (limits and quotas).
- A default-deny NetworkPolicy, allowing DNS and what the tenant needs.
- Admission policy for what Pod Security doesn’t cover: allowed registries, required labels, no claiming other tenants’ hostnames in Ingress or Gateway routes.
- PriorityClass restrictions so one tenant can’t preempt everyone.
Generate all of it from a template, with Kustomize, a Helm chart or an ApplicationSet, so the tenth tenant is identical to the first. Tools like Capsule build tenant abstractions on top.
Where namespaces stop
Some things are cluster-scoped, so every tenant shares them: CRDs (one version for everyone), ClusterRoles, admission webhooks, StorageClasses, IngressClasses, nodes, and the API server’s capacity (API Priority and Fairness helps). Pods from different tenants also share node kernels. For trusted teams this is fine, “soft” multi-tenancy. For untrusted code or regulated data it isn’t. The options, in rising isolation:
- Sandboxed runtimes (gVisor, Kata Containers) through a RuntimeClass, so a container escape lands in a sandbox, not the node.
- Dedicated node pools per tenant with taints and affinity, enforced by admission policy.
- Virtual clusters (vCluster, v0.38 when checked): each tenant gets its own API server running as Pods in a host cluster, with their own CRDs, RBAC and even version, while workloads run on the host’s nodes. Control-plane isolation without separate infrastructure. Node-level isolation still depends on the host’s controls.
- Separate clusters.
Running many clusters
Companies split clusters for blast radius (a bad upgrade hits one), environment separation, regions, compliance and team autonomy. The cost is N of everything. Treat them as a fleet, not pets:
- Create them from code: Cluster API (Kubernetes objects describing clusters), Terraform (see clusters and providers), or the cloud’s fleet tooling.
- Configure them with GitOps: an Argo CD ApplicationSet with the cluster generator puts the same add-ons on every registered cluster.
- Connect them deliberately: global load balancing or DNS for user traffic, the Multi-Cluster Services API or a service mesh for service-to-service calls, and a shared identity source.
- Observe them together: central metrics and logs with a cluster label on everything.
- Upgrade them in waves, canary clusters first.
The common mistake is to start with many clusters before there’s automation to run them, or to keep one giant cluster long past the point where every upgrade is an all-company event.
About the video
The embed is vCluster’s “Multi-Tenancy in Kubernetes : Three Different Ways”, February 2024, 11 minutes. Its chapters walk from everyone-is-admin, to restriction by namespace, to virtual clusters. It’s a vendor’s channel and ends with its product, but the progression is a fair map of the choice. It doesn’t cover multi-cluster, which the CNCF talk in deeper does through two companies’ case studies. I judged it from chapters and description only, since transcripts couldn’t be fetched. English was judged from its “English (US) original” audio track.
What was run: the tenant namespaces, quota, RoleBindings, every can-i answer and the quota rejection are real output from a local Kubernetes v1.37.3 API server whose nodes run no containers. vCluster, sandboxed runtimes, network enforcement and multi-cluster tooling weren’t run. They’re from the multi-tenancy docs and each project’s documentation, checked 2026-11-29.
Where this fits
This closes the Kubernetes roadmap. To build clusters themselves as code, continue with Kubernetes clusters and the Kubernetes and Helm providers, or revisit the control plane now that you’ve run into all of it.
Check yourself
A team has the edit role in their namespace. What is something they can't do, and something risky they still can?
They can't create namespaces, read other namespaces' Secrets, manage RoleBindings, change their quota or create CRDs. They can still create Pods, which can mount any Secret in their namespace and use any of its ServiceAccounts, and edit lets them impersonate those ServiceAccounts.
Why can't two namespace tenants run different versions of the same operator's CRDs?
CustomResourceDefinitions are cluster-scoped. There is one definition per group and kind for the whole cluster. Tenants needing different CRD versions need virtual clusters or separate clusters.
What does a NetworkPolicy-less namespace allow by default?
All traffic in and out, including from every other tenant's Pods. A default-deny policy per tenant namespace, plus explicit allows for DNS and needed services, is the starting point.
When is a separate cluster per environment or tenant worth the overhead?
When a failure or compromise in one must not touch another (production versus experiments, hostile tenants, compliance boundaries), when tenants need cluster-level control or different versions, or for regional latency and disaster recovery.
Go deeper
Notes
Notes are saved to your account.
Everything else on this page works without one — progress and bookmarks keep themselves in this browser and come with you when you sign in. Notes are the one thing worth not trusting to a browser you might clear.
Your notes could not be loaded.