Skip to content

Lesson 13 of 14 · 12m

When Namespaces Aren't Enough

gVisor reimplements syscalls in a Go userspace kernel, Kata gives each pod its own VM kernel, and RuntimeClass routes untrusted pods to them.

When the shared kernel is the problem

Everything so far hardens a model that still ends at one kernel. If your workload is running other people's code — a code runner, a CI service, a serverless platform, tenant workloads — a kernel bug you haven't patched yet is the difference between "attacker has a shell in a box" and "attacker has the node." The two mature answers both insert a second kernel between the guest and yours. They cost real money; the point is knowing when to pay.

gVisor: a kernel that speaks Linux

gVisor replaces the syscall table instead of sharing it. runsc, its OCI runtime, starts each container behind Sentry — an application kernel written in Go that reimplements about 70% of Linux's syscall surface in userspace. A guest process calling splice or io_uring_setup doesn't reach your kernel's implementations; it reaches Sentry's, and Sentry itself runs under its own tight seccomp filter making a deliberately small set of real syscalls. The host kernel sees one ordinary process. The bugs in lesson ten mostly die at the Sentry boundary — Dirty Pipe's splice semantics, the netfilter engine, io_uring all live in implementations the guest can't reach.

The costs are compatibility and speed. Unimplemented syscalls, ioctls, and /proc semantics break unusual binaries; syscall-heavy and I/O-heavy workloads pay a measurable tax; raw device access mostly doesn't exist. Google runs it where strangers' code runs — App Engine, Cloud Run's isolation model, and GKE Sandbox as a node-pool option — which is the correct signal for when to adopt it.

Kata: a VM that looks like a container

Kata Containers goes the other direction: keep the container UX, give each pod its own guest kernel inside a lightweight VM. Current Kata runs QEMU, Cloud Hypervisor, or Firecracker under the hood; the pod gets real ioctl support, real /proc, real everything — because it is a real VM, just a small one. The wall is hardware virtualization, the thing namespaces never had.

The costs are startup latency and memory: each pod is a VM, so you boot a guest kernel per pod (hundreds of milliseconds, not the microseconds of clone), and each guest carries kernel memory overhead. Confidential-computing deployments (SEV-SNP, TDX) pair naturally with Kata because the VM boundary is where the attestation happens. For ordinary multi-tenant container hosting it's often more isolation than the threat model needs — which is a fine problem to have and an informed choice to make.

Firecracker: the VMM behind Lambda

Firecracker is AWS's Rust VMM on KVM: ~125 ms boots, ~5 MB baseline overhead per microVM, deliberately minimal device model. It is why Lambda and Fargate can run millions of strangers' functions on shared metal — namespaces were never going to carry that threat model, so Amazon built the thing that does. You mostly meet Firecracker through Kata or through serverless platforms rather than deploying it bare.

Kubernetes wiring

The mechanism for mixing runtimes is RuntimeClass — a cluster object mapping a name to a containerd handler:

apiVersion: node.k8s.io/v1
kind: RuntimeClass
metadata:
  name: gvisor
handler: runsc
spec:
  runtimeClassName: gvisor

Untrusted tenant pods get runtimeClassName: gvisor or kata; everything else stays on runc. Admission policy (Gatekeeper, Kyverno) can require the runtime class for labeled namespaces — "all pods in tenant-workloads must run under runsc" is an enforceable rule, not a hope.

What to actually do

The decision rule: if the workload is yours and trusted, namespaces + hardening are enough and the extra layer buys little. If the workload executes code you didn't write — code runners, CI for public repos, tenant containers — put it behind gVisor or Kata and keep the hardening anyway, because the sandbox protects the boundary while caps and seccomp shape what's inside. And when you deploy a sandboxed runtime, test compatibility up front: Sentry's missing syscalls fail at runtime, not at deploy time, and "works on runc" does not prove "works on runsc."

Was this lesson helpful?

Sign in to rate

Keep reading

Related articles from the SudoSecurity blog.