Multi-Tenancy Models
A platform runs many teams' workloads, and the first architecture question is how to share Kubernetes between them. A tenant is whatever unit you isolate: usually a team, sometimes a product, an environment or an external customer. The options range from "a namespace each" to "a cluster each", and the right answer depends on how much the tenants trust each other.
The spectrum
| Model | Isolation | Cost and effort | Tenants can install CRDs/operators? | Typical use |
|---|---|---|---|---|
| Namespace per tenant (+ quotas, RBAC, network policies, Pod Security) | soft: shared control plane, shared nodes | lowest; one cluster to run | no | internal teams in one company |
| Namespace groups (Capsule, Hierarchical Namespaces) | soft, but a tenant can own several namespaces with shared policies | low | no | teams that need many namespaces (per app, per preview) |
| Virtual cluster per tenant (vcluster) | each tenant gets its own API server and control plane objects; workloads still share nodes | moderate | yes, inside the virtual cluster | CI and preview environments, teams that need cluster-admin, training |
| Dedicated nodes (taints, node pools per tenant) | adds kernel/node isolation to any of the above | higher | depends | noisy or sensitive workloads |
| Cluster per tenant | hard: separate control planes and nodes | highest; fleet management needed | yes | regulated workloads, external customers, very different SLAs |
Kubernetes' own docs call the first family soft multi-tenancy (tenants are cooperative, e.g. teams in one company) and the last hard multi-tenancy (tenants may be hostile). Containers share a kernel: a container escape on a shared node reaches every tenant on it, so untrusted tenants need at least separate nodes, often separate clusters or sandboxed runtimes (gVisor, Kata Containers).
What a namespace tenant needs
A namespace alone isolates almost nothing: by default any Pod can talk to any Pod, and a team without quotas can starve the cluster. The Kubernetes course introduced each piece; a tenant kit puts them together:
| Concern | Object | Covered in |
|---|---|---|
| Fair share of resources | ResourceQuota, LimitRange |
Kubernetes: quotas |
| Who may do what | RoleBinding to the built-in admin/edit/view ClusterRoles or custom Roles |
Kubernetes: RBAC |
| Network isolation | NetworkPolicy: default deny, then allow the gateway, monitoring and DNS |
Kubernetes: network policies |
| Workload security | Pod Security Admission labels (restricted) on the namespace, plus policies (Kyverno, Gatekeeper) |
Kubernetes: security contexts |
| Cost attribution | labels on the namespace (team, cost-center) |
Cost Allocation |
| Discovery | the namespace and its owner in the catalog | Software Catalog |
The next lesson renders that kit for every team from one values file.
The noisy neighbour, modelled
Why quotas matter: without them, the scheduler places Pods first come, first served, and one team's runaway HPA can use the cluster's spare capacity before anyone else asks. A small model of a 32-CPU cluster during a traffic spike:
CLUSTER_CPU = 32
demand = [ # (team, CPU requested in order of arrival)
("team-growth", 4), ("team-links", 6),
("team-growth", 12), ("team-growth", 8), # growth's HPA scales out on a spike
("team-qr", 4), ("team-links", 6),
]
QUOTA = {"team-growth": 12, "team-links": 14, "team-qr": 6}
def schedule(with_quota):
used, per_team, rejected = 0, {}, []
for team, cpu in demand:
if with_quota and per_team.get(team, 0) + cpu > QUOTA[team]:
rejected.append(f"{team}+{cpu} (quota)")
continue
if used + cpu > CLUSTER_CPU:
rejected.append(f"{team}+{cpu} (cluster full)")
continue
used += cpu
per_team[team] = per_team.get(team, 0) + cpu
return per_team, rejected
for with_quota in (False, True):
per_team, rejected = schedule(with_quota)
print("with quotas" if with_quota else "no quotas ", dict(sorted(per_team.items())))
print(" pending:", ", ".join(rejected) or "-")no quotas {'team-growth': 24, 'team-links': 6}
pending: team-qr+4 (cluster full), team-links+6 (cluster full)
with quotas {'team-growth': 12, 'team-links': 12, 'team-qr': 4}
pending: team-growth+12 (quota)
Without quotas, team-growth takes 24 of 32 CPUs, and team-qr's Pods and team-links' scale-out stay pending: an outage for teams that did nothing wrong. With quotas, growth's spike is capped at its share (one 12-CPU step is refused, the smaller one fits) and everyone else is placed. Quotas move the pain to the team that caused it, which is also the team that can fix its autoscaling limits. (A quota can't be larger than what the cluster can actually supply in total: keep the sum of quotas, or of guaranteed requests, within capacity, or accept explicit overcommit.)
Choosing
- Start with namespaces for internal teams; it's the cheapest model that works, and the tenant kit makes it consistent.
- Add vcluster where teams need cluster-scoped things (their own CRDs, operators, cluster-admin for experiments) or for ephemeral environments.
- Separate clusters where the blast radius or compliance requires it: production vs non-production, regulated data, external customers. Then you need fleet tooling (Argo CD ApplicationSets with the cluster generator, see GitOps: ApplicationSets).
Test yourself
Why is namespace-based tenancy called 'soft'?
- Namespaces are YAML
- Tenants share the control plane and nodes (one kernel), so isolation assumes cooperative tenants
- Namespaces can be deleted
- Quotas are optional
Which model gives each tenant its own API server while sharing worker nodes?
- Namespace per tenant
- Virtual clusters (vcluster)
- Cluster per tenant
- Dedicated nodes
In the noisy-neighbour model, what did quotas change?
- They made the cluster bigger
- They capped team-growth's spike at its share, so the other teams' Pods were scheduled
- They rejected all Pods
- Nothing