- Goal: reduce blast radius, enforce least privilege, and ensure fair resource usage across tenants.
- Scope: cluster-scoped controls and namespace-scoped controls combined.
- Recommended: apply Namespaces, RBAC, ResourceQuotas, NetworkPolicies, and Pod Security Standards together.
For detailed references:
The guardrail layers (bottom → top)
Namespaces
- Provide logical isolation and a naming boundary that separates resources for different teams, applications, or environments.
- They are the foundation for the rest of the guardrail stack.
- Most guardrails are applied at the namespace level; some controls (for example ClusterRoles/ClusterRoleBindings or cluster-scoped admission controllers) operate at cluster scope.
- Controls who can do what inside a namespace (and at cluster scope when using ClusterRoles/ClusterRoleBindings).
- Define Roles or ClusterRoles that list allowed verbs on resources, and RoleBindings to assign those Roles to users or service accounts.
- RBAC answers: can this user or service account perform this action on this resource in this namespace?
- Cap total resource consumption per namespace: CPU, memory, storage, and counts of Kubernetes objects (pods, services, ConfigMaps, secrets, etc.).
- Enforce fairness so a single namespace cannot starve others.
- Treat ResourceQuotas as hard limits on requested resources and object counts — they prevent creating new objects or requests that would exceed the quota.
- Note: runtime enforcement of CPU/memory consumption is handled by LimitRanges, container runtimes, cgroups, and eviction behavior; quotas govern requested resources and counts.
- Act as pod-to-pod firewall rules to restrict network communication.
- Kubernetes treats NetworkPolicy as opt-in: if no policy selects a pod, traffic is typically allowed. Apply policies to create deny-by-default behavior and explicitly permit required flows.
- Example use case: allow only frontend pods to reach backend pods on TCP/8080.
- Replaces the older PodSecurityPolicy model and is enforced via the Pod Security Admission controller (and other policy engines like OPA/Gatekeeper).
- Prevents workloads from performing dangerous operations such as:
- running as root,
- using privileged mode,
- mounting host filesystems,
- binding to the host network.
- Three policy levels:
- Privileged — allows everything (least restrictive).
- Baseline — sensible defaults for general workloads.
- Restricted — strict settings for high-security workloads.
- Namespaces: logical isolation and naming boundaries.
- RBAC: who may perform which actions.
- ResourceQuotas: fairness and resource limits.
- NetworkPolicies: network segmentation and least privilege network flows.
- Pod Security Standards: workload hardening and attack surface reduction.

Recommendation: for most organizations either the by-team pattern or by-app-plus-environment pattern works well. Consistency is the most important property — pick a pattern and enforce it.
Enforcement techniques
- Use validating admission webhooks or automation to prevent teams from creating namespaces that break your policy.
- Automate namespace lifecycle and labeling to ensure tools (billing, monitoring, security) can rely on predictable metadata.
Automate namespace creation with templates that include standard labels, ResourceQuotas, LimitRanges, NetworkPolicies, and Pod Security labels. This reduces drift and ensures guardrails are applied consistently.

Kubernetes is not multi-tenant by default. Design and apply multiple guardrails to achieve safe multi-tenancy in production.
- Kubernetes is not multi-tenant by default — this is the single most important point.
- Soft vs. hard multi-tenancy is determined by how much you trust tenants:
- Trusted tenants: soft multi-tenancy with strict guardrails can be cost-effective.
- Untrusted tenants: prefer stronger isolation (separate clusters, VMs, or stricter policies).
- Layer your guardrails — no single mechanism provides complete isolation. Use Namespaces, RBAC, ResourceQuotas, NetworkPolicies, and Pod Security Standards together.
- Consistent namespace naming matters. Choose a pattern and enforce it with admission controllers and automation.
- Dive deeper into ResourceQuotas + LimitRanges to create practical quota policies and patterns for fair resource allocation.
- Explore admission controllers (validating and mutating webhooks) and OPA/Gatekeeper for custom policy enforcement.
- Review Pod Security Admission labels and how to migrate workloads across Pod Security levels.
- Kubernetes RBAC
- Kubernetes NetworkPolicy
- Pod Security Admission controller
- ResourceQuotas and LimitRanges