Namespaces organize tenants; authority comes from policy
Trace authentication, additive RBAC, admission, workload identity, and runtime enforcement across a Kubernetes tenant boundary.
On this page
The question for today
What you’ll understand
- Distinguish a Kubernetes namespace from a complete tenant security boundary.
- Analyze the authority created by roles, bindings, and workload creation.
- Construct a finite permission matrix without overstating its coverage.
Creating one Kubernetes namespace per customer is an organizational step, not a complete isolation argument. A customer might still hold a cluster-wide binding, launch a pod using a powerful service account, or reach a shared service that trusts an unvalidated tenant header. This lesson scopes the API examples to Kubernetes 1.34. The important question is how an authenticated principal acquires authority over each operation, including operations performed later by controllers and workloads on that principal’s behalf.
Follow identity through every authorization gate
Authentication establishes which principal the API server recognizes; authorization decides whether that principal may perform the requested action. Namespace-scoped RoleBindings and cluster-wide ClusterRoleBindings have different scopes, and RBAC permissions are additive. A narrowly intended RoleBinding does not subtract authority already granted through another binding. Inspect the complete effective set, including group membership and service accounts, rather than treating a role’s name as proof of least privilege. Cluster-scoped resources also need their own analysis because putting a workload in a namespace does not make every resource namespaced.
Admission is a separate decision after the relevant authentication and authorization stages. A principal allowed to create pods can potentially cause code to run with a service account available in that namespace, mount accessible secrets, or request dangerous host features unless additional policy constrains those choices. Therefore “cannot read secrets directly” does not settle the indirect authority of a pod creator. Follow the authority of the resulting workload and the controllers that act on its specifications. Record who can change policy, bindings, admission configuration, and the service accounts that privileged automation uses.
Admission quotas do not replace resource or network enforcement
A ResourceQuota constrains specified aggregate resource requests, limits, or object counts through admission semantics. It can prevent a tenant from creating another object once the configured budget is exhausted. That does not mean every already running request has a dedicated physical resource reservation, nor that API object counts are a per-second traffic limit. Scheduling, node-level cgroups, storage policies, network enforcement, and application tenant checks remain separate mechanisms. Identify the controller and enforcement point responsible for each promise rather than attaching all promises to the namespace label.
A shared control plane also contains expensive paths: list operations, watches, admission webhooks, custom controllers, and reconciliation work. Namespace separation does not prevent one tenant’s permitted requests from stressing a shared dependency. Bound and observe those paths according to the actual supported mechanisms. Likewise, an allowed network connection is not permission to read every object the target service can reach. The service must retain the tenant’s authenticated authority when acting on its behalf, particularly when it uses a more powerful common storage credential.
Use negative tests with explicit coverage
Build an identity-action-resource matrix that includes intended allows and intended denials. Test actual operations using isolated fixtures, including creation paths that can indirectly gain authority. Preserve audit evidence and distinguish a denial by the intended policy from a denial caused by a missing object or broken network. Repeat after relevant role, controller, or admission changes. A finite matrix is valuable regression evidence, but it covers only its listed principals, verbs, resources, and configurations; it does not prove every custom resource or future service obeys the same boundary.
For a detection-probability analogy, Reset the probability lab, explicitly set success probability 0.1 and trials ten, predict the probability of at least one success, then Play or Step. Compare a fresh Reset with both settings explicitly restored as 0.1 and 20. Playback tours an exact binomial distribution rather than issuing API requests. Independent trials with known probability are assumptions, not properties of authorization tests. Carefully selected adversarial cases can be more informative than many repetitive random cases, especially when the untested boundary is a privileged creation path.
Work it through
Count the finite matrix and name what it misses
A fixture has two tenant identities, two namespaces, one namespaced resource type, and two verbs: get and list. Each identity may use both verbs only in its own namespace. Count the explicit allow and deny cases.
The Cartesian product contains two identities times two target namespaces times two verbs, or eight distinct cases. Keep the resource type fixed so that this count has an unambiguous scope.
Each identity has two allowed cases in its own namespace and two denied cases in the other namespace. Across both identities there are four expected allows and four expected denials. Verify the intended reason for each denial with actual fixture objects present.
Passing all eight says nothing directly about creating pods, choosing service accounts, reading secrets, cluster-scoped resources, or another controller’s credentials. Add those paths according to the threat model rather than describe this small matrix as complete Kubernetes isolation.
The matrix is a precise eight-case regression oracle. Its value comes from explicit expected authority and an honest coverage boundary.
The living notebook
Explore the model
Interactive lab · probability
More independent probes improve only a stated toy model
Use separate Reset → explicitly set BOTH p and n → predict → Play/Step runs for (.1,10) and (.1,20). At least one success has probability 1−.9ⁿ. Outcomes are exact binomial probabilities, not real policy probes or sampled playback.
- Mean · np
- 5
- Variance · np(1−p)
- 2.5
- Total probability
- 1
These are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forCoverage selection and authority modeling matter beyond the number of repeated tests.
Pause & reason
Check your understanding
Your turn
Try it yourself
A permission fixture covers three identities and three namespaces, two verbs, and one fixed namespaced resource type. Each identity should be allowed only in its own namespace. Count all cases and expected denials. Then explain why an unrelated missing object is a poor denial oracle.
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
Count the full product, subtract the own-namespace cases, and distinguish policy denial from an operation failing for another reason.
Compare with the solution
There are 3×3×2=18 cases. Each identity has two own-namespace allows, giving six allows and twelve expected denials. A missing object can make an operation fail even when authority is too broad, so it does not establish the intended boundary. Provide controlled objects and inspect the response and audit context. Extend coverage for indirect pod creation authority, service accounts, cluster-scoped resources, and custom controller behavior as required; the arithmetic only describes this deliberately narrow matrix.
Keep the idea
Take it with you
- Evaluate complete effective authority, including additive bindings and indirect workload creation.
- Namespace quota admission and runtime resource isolation are different mechanisms.
- A finite allow/deny matrix supplies evidence within its named scope.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.