A container feels like a box, but it is really just a process with some namespaces around it. It makes system calls directly to the host kernel, the same kernel every other pod on that node is using. The isolation is only as strong as the kernel’s syscall surface — which is large, and occasionally has holes.
gVisor changes the shape of that risk. It runs a second, much smaller kernel called the Sentry in user space, written in Go. The workload’s syscalls are answered by the Sentry, and the Sentry itself only makes a narrow, carefully chosen set of real calls to the host.
The problem it solves
In this system the operator is deliberately generic: a QueueWorker names a
container image and the controller runs it, with no idea what the code
inside does. That is the feature — it is what lets one operator serve any
number of unrelated queues.
It is also the problem. The moment the image is something you did not write — a tenant’s plugin, a third-party processor — “it shares the host kernel with everything else on this node” is no longer a comfortable sentence.
How it works
What happens at each hop:
- The pod asks for a runtime. A
runtimeClassNameon the pod spec is a request for a named RuntimeClass. Leave it off and you get the cluster default. In this project the field travels from theQueueWorkerCR, through the chart, onto the Job’s pod template. - containerd routes it. The
gvisorRuntimeClass maps to therunschandler, so containerd starts that pod with gVisor instead of runc. - The Sentry intercepts. The container’s syscalls are serviced inside the Sentry rather than by Linux. Most of the kernel surface the workload could previously reach simply is not there any more.
- A narrow path reaches the host. The Sentry makes a restricted set of real syscalls — that remaining surface is the actual attack surface, and it is dramatically smaller than the full kernel ABI.
Crucially this is per-pod, not per-cluster. Untrusted workers run sandboxed while Redis, the operator and the monitoring stack keep full performance on the default runtime.
The detail that bites
The field is a *string, not a string, and that distinction is load-bearing:
func runtimeClassNameOrNil(name string) *string {
if name == "" {
return nil
}
return &name
}
Kubernetes validates runtimeClassName as a DNS name whenever the field is
present, so an empty string is rejected at admission rather than read as “no
preference”. Only nil means “use the cluster default”. Without this helper,
every pod that simply did not opt in would fail to be created at all.
What I would tell you before adopting it
The Sentry implements a subset of Linux, and the things that break are
rarely the application — they are the tools around it. In this project
kubectl port-forward stopped working against sandboxed pods: it dials the
pod’s network-namespace loopback, but a gVisor pod’s sockets live in runsc’s
userspace netstack. Traffic to the pod IP works; loopback does not. The fix
was a NodePort Service for local access.
There is a throughput cost too, concentrated in syscall- and I/O-heavy workloads. So this is not a cluster-wide default — it is a boundary you draw around the specific code whose behaviour is not yours.
The CRD field, the Job builder and the chart plumbing are in the repo.