Multi-tenancy and isolation
Choose the boundary by trust
A tenant is a team or customer whose workloads and access must be governed separately. Imagine two internal bookstore teams sharing infrastructure and a third customer running untrusted code. A namespace provides a naming and policy scope, not a standalone security sandbox. For cooperating internal teams, namespaces plus enforced controls may be appropriate. If tenants need independent cluster-scoped APIs, a virtual control plane is a candidate; if they execute hostile code or need a separate failure domain, prefer a dedicated cluster with reviewed infrastructure and isolation. Separate clusters still share risk if they use the same credentials, network or management system.
Internal catalog and billing: shared cluster with distinct namespacesExternal untrusted workloads: separate cluster and isolated infrastructureBuild layers that do different jobs
Use namespace-scoped RoleBindings for API access; grant only verbs and resources needed. ResourceQuota caps aggregate declared resources, while LimitRange can set defaults and constraints. Neither makes a physical node exclusive. Apply admission controls such as restricted Pod Security where suitable and prohibit unsafe host access. Use a policy-capable CNI, ingress and egress isolation, and explicit rules for necessary DNS and application paths. NetworkPolicy does not grant API permission and cannot substitute for application authentication. Test the positive case as well as a denied case. A permitted API request does not mean a network connection is permitted.
catalog-reader -> get pods in catalog: allow by intended rolecatalog-reader -> get secrets in billing: denycatalog frontend -> catalog API TCP/8080: intended allowcatalog frontend -> billing API TCP/8080: intended denyDedicated nodes and virtual control planes
Taints can repel workloads without tolerations, but a toleration alone does not force placement. Pair dedicated nodes with constrained node affinity and admission rules that prevent unauthorized use of those labels and tolerations. Nodes still share a cluster control plane. Virtual control planes can separate API configuration and cluster-scoped objects, but shared worker infrastructure requires its own data-plane security. Review kernel/runtime isolation, storage, network paths, administrators and credentials. Do not equate any single mechanism with complete tenant isolation.
Boundary | API separation | worker separationNamespace | shared API | shared by defaultDedicated node pool | shared API | intended dedicated placementVirtual control plane | distinct tenant API | depends on implementationSeparate cluster | distinct API | verify underlying infrastructureReason about quotas and noisy neighbors
Suppose catalog has a 2 CPU request quota and already requests 1500m. A new workload requesting 600m would take the total to 2100m, above the quota. It should be rejected under this simplified quota scenario even if nodes have spare CPU. Reducing the request to 500m fits the quota but does not guarantee scheduling; node availability and other constraints still matter. Shared API servers, storage and network capacity can also be contention points. Monitor tenant usage and define escalation and capacity policies.
1500m + 600m = 2100m > 2000m -> reject1500m + 500m = 2000m -> quota fits, scheduling not guaranteedVerify isolation before onboarding
The lab includes a namespace, a narrow Role and binding, a quota and a deny-by-default NetworkPolicy. These static manifests are not a complete working tenant: DNS and application exceptions need explicit review, and no CNI is tested. For an authorized disposable environment, verify same-tenant access, denied cross-tenant access, required DNS, allowed application traffic and rejected unwanted traffic, then check admission and quota evidence. Missing evidence is a HOLD, not a pass. Never test another real tenant.
lab-fixtures/multi-cluster-tenancy/tenant-baseline.yamlpython validate_offline.py # run from the lab directory; synthetic cases onlyFurther reading
- https://kubernetes.io/docs/concepts/security/multi-tenancy/ — Namespace and virtual control-plane tenancy, isolation and noisy neighbors
- https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ — Namespace scope and naming
- https://kubernetes.io/docs/concepts/policy/resource-quotas/ — Aggregate namespace resource limits, not node isolation
- https://kubernetes.io/docs/concepts/services-networking/network-policies/ — NetworkPolicy semantics and implementation dependence
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Multi-tenancy and isolation — knowledge check
Choose namespace, node or cluster boundaries
What does a namespace provide?
What is the effect of ResourceQuota on node placement?
What must accompany a dedicated node toleration to constrain placement?
Which evidence is needed for tenant network isolation?
A quota is 2000m and existing requests total 1500m. Can a 600m request fit?