Running Untrusted AI-Built Apps on Bare Metal: Cilium Full eBPF (36.1 Gbps), gVisor, and Zero-Code Access Protection
How we replaced kube-proxy with Cilium full eBPF on 40GbE, dodged a subtle gVisor Socket LB packet-drop pitfall, locked down LAN egress, and added Traefik ForwardAuth access gates ahead of KEDA.
When you let developers—and their coding agents—deploy arbitrary Dockerfiles onto a bare-metal cluster sitting inside a real building, network and kernel isolation stop being optional checklists.
Our defense-in-depth model has three layers: Cilium Full eBPF for fast, strict L3/L4 isolation, gVisor (runsc) as the mandatory default container runtime for untrusted apps, and Traefik ForwardAuth so private apps and PR previews do not even wake from sleep on unauthenticated traffic.
1. Dropping kube-proxy for Cilium Full eBPF (36.1 Gbps over 40GbE)
We disabled kube-proxy across all 8 bare-metal nodes—taking iptables KUBE-* chains from 681 rules per node straight down to 0—and enabled Cilium eBPF host-routing, BPF masquerading, and EDT bandwidth management (CUBIC).
Measuring cross-node ClusterIP traffic across our 40,000 Mb/s NICs (1 GiB x 3 median TCP bulk) showed throughput jumping from 33.485 Gbps to 36.096 Gbps (+7.8%):
ClusterIPHTTP Keep-Alive p95 latency dropped-20.7%(0.0440 ms -> 0.0349 ms).- CoreDNS UDP p95 latency dropped
-21.0%(0.0542 ms -> 0.0428 ms).
The Gotcha: gVisor + Cilium Socket LB
Enabling bpf-lb-sock=true globally immediately bit us: gVisor (runsc) handles networking in userspace (AF_PACKET), so Pods running under gVisor dropped ClusterIP packets before bpf_lxc translation could happen.
The fix was switching Cilium to bpf-lb-sock-hostns-only: "true" (socketLB.hostNamespaceOnly: true)—keeping host-namespace Socket LB fast-paths intact while falling back cleanly to per-packet eBPF load balancing on Pod veth interfaces.
We also tuned runsc.toml (directfs = "true", num-network-channels = "4"), pushing gVisor internal TCP throughput (tcp_128mib median) from 18.79 Gbps up to 20.47 Gbps (explicitly keeping tx-checksum-offload disabled after testing showed timeouts over Cilium eBPF veth).
2. Four Clusterwide Policies Blocking All Private LAN & SMTP
Instead of juggling hundreds of fragile per-namespace rules, we consolidated customer isolation into 4 CiliumClusterwideNetworkPolicy (cilium.io/v2) objects (default-deny ingress and egress), dropping total policy count across the cluster from 354 down to 212.
- Untrusted runtime lock: Kubernetes
ValidatingAdmissionPolicy(pangea-http-runtime-pods) + API guards enforceruntimeClassName: gvisorfor all standard workspaces (HTTP 403otherwise), alongsiderunAsUser=1000,readOnlyRootFilesystem=true,drop ALL, andautomountServiceAccountToken=false. - Live egress verification: Probing from inside a tenant Pod (
1.5stimeout) confirmedOPENfor public internetHTTPS (443)and DNS (53), while returningBLOCKED (errno=110 timeout)for every RFC1918/CGNAT range (192.168.0.0/16,10.0.0.0/8,172.16.0.0/12,100.64.0.0/10), our edge proxy, the Control Plane API, cross-tenant Pod IPs, and outbound SMTP (:25,:465,:587).
3. Zero-Code Access Protection Ahead of KEDA Scale-to-Zero
Developers deploying internal admin tools or PR previews constantly ask for one thing: "Put a login wall in front of this app without making me write OAuth boilerplate inside the container."
We wired an internal-only ASGI ForwardAuth verifier directly into our HA Control Plane API (:8081, reachable exclusively from kube-system/traefik) and attached Middleware/pangea-access-gate to protected app Ingresses and KEDA routes (public apps get zero middleware and zero latency overhead):
- Does not wake sleeping containers: Because Traefik runs
ForwardAuthbefore the KEDA HTTP Interceptor, unauthenticated requests receive302or401right at the edge. Live E2E testing confirmed 10/10 unauthenticated hits kept sleeping Pods at0. - Seamless Google/GitHub reuse + scoped cookies: Browsers redirect through
https://pangea.host/access/login, exchange a signed 60-second ticket via/.well-known/pangea-access/callback, and receive a host-scoped 12-hourHttpOnly; Secure; SameSite=LaxHMAC-SHA256 cookie (__pangea_access). Users already signed intopangea.hostunlock preview subdomains in ~0.1swith zero extra password prompts. - Anti-spoofing & policy versioning: Every allowed request carries verified
X-Pangea-Auth-Email,X-Pangea-Auth-Subject, andX-Pangea-Auth-Userheaders—and explicitly wipes those headers to empty strings on service-token (X-Pangea-Access-Token) or--bypasspaths so callers can never spoof identity headers. Changing an allowlist incrementspolicy_version, invalidating old cookies cluster-wide within seconds (~6sverified live). - Zero-touch PR preview defaults: A single
pangea access default set <repo_id> --workspace-membersautomatically locks down every new PR preview from that repository, and repository config files inside a PR (pangea.yaml, etc.) are blocked from weakening policies.
Isolation does not have to feel slow or heavy—eBPF keeps 40GbE fast, gVisor + clusterwide Cilium policies contain untrusted code by default, and putting auth at Traefik protects sleeping apps before a single container even boots.