Skip to content

Lesson 6 of 13 · 10m

Namespaces Are Labels, Not Boundaries

Flat pod networking, one shared kernel, CVE-2020-8554 traffic interception, and what hostile-tenant isolation actually costs.

A namespace is a naming scope, not a wall

The wrong mental model to kill early: namespaces as tenant isolation, "folders that can't see each other." What a namespace actually is: a scoping label for object names, RBAC bindings, ResourceQuotas, and NetworkPolicy selectors. That is the complete list of what it isolates.

What it does not isolate:

  • Network. The pod network is flat — every PodCIDR is routable to every other across all namespaces. payments and public pods can open sockets to each other unless NetworkPolicy says otherwise.
  • Node. All pods on a node share one kernel, one kubelet, one CNI datapath. hostPath: / mounted from any namespace reads the node's whole filesystem — including /var/lib/kubelet, where credentials live.
  • Etcd. Secrets and specs from all namespaces sit in the same datastore; anyone with etcd client access reads all of it.
  • Capacity. ResourceQuota bounds a namespace's consumption, but CPU, memory, and the kernel are still physically shared. A noisy neighbor is a noisy neighbor regardless of the label on its pods.

This is why the hardened fields from the last lesson matter: hostPath, hostNetwork, hostPID/hostIPC are the mechanisms that reach across namespaces, and baseline Pod Security exists to remove them.

One more shared surface worth auditing: the kubelet's own API on port 10250. --anonymous-auth=true is still the kubelet's flag default — what changed is who writes the config. kubeadm's generated /var/lib/kubelet/config.yaml sets authentication.anonymous.enabled: false, managed providers do the same, and the read-only port 10255 that once served pod data to anyone is gone entirely. The open kubelets left are hand-rolled kubelet configs that never touched the flag — grep anonymous /var/lib/kubelet/config.yaml is a one-command audit, and an answering kubelet can exec into any pod on its node.

The API-level hole nobody patched

CVE-2020-8554 is the cleanest demonstration that namespaces don't bound each other. Any user who can create a Service can set spec.externalIPs — and Kubernetes will route other pods' traffic destined to those IPs to that user's pods. A tenant in namespace sandbox could intercept cluster traffic aimed at an IP of their choosing. Kubernetes marked it won't-fix: it's a designed feature, not a bug. The mitigation is admission policy forbidding externalIPs in Services — not "trust the namespace boundary," because there isn't one.

What multi-tenancy actually costs

"Soft" multi-tenancy — multiple teams sharing a cluster who aren't actively hostile to each other — works fine with namespaces plus RBAC plus NetworkPolicy plus quotas. The failure case is hard multi-tenancy: untrusted or mutually hostile workloads, like a platform executing customer code.

The honest options, in ascending isolation:

  • Sandboxed runtimes. RuntimeClass lets you run selected pods under gVisor's runsc (a userspace kernel that filters syscalls) or Kata/Firecracker microVMs (each pod in its own VM). Costs performance on syscall-heavy and startup-heavy workloads; buys a real kernel boundary.
  • Virtual clusters. vCluster runs a full virtual Kubernetes control plane inside a host namespace — the tenant gets their own API server view, their own RBAC and CRDs, synced down to host-cluster pods — without trusting them on the host API.
  • Separate clusters. The only boundary that also isolates etcd, the kubelet fleet, and the control plane. Costs you N control planes and N CI targets; buys the only isolation a hostile tenant should get.

Picking namespaces for adversarial tenancy is the classic mistake — you're using a scheduling primitive as a security boundary and it will lose to hostPath, externalIPs, or a shared-kernel escape, in that order of difficulty.

What to actually do

Namespaces for organizational scoping, quotas, and policy targets — yes. Isolation claims about them — no. For tenant-grade separation, run untrusted pods under a RuntimeClass pointing at gVisor or Kata, and for regulated or genuinely adversarial tenancy, separate clusters. Anything in between is marketing.

Was this lesson helpful?

Sign in to rate

Keep reading

Related articles from the SudoSecurity blog.