All posts
Cloud & DevOps
4 min read• 12/1/2026

Replacing Sidecar Proxies: Bare-Metal eBPF Routing with Cilium in Production

Service mesh sidecars consume vast memory and introduce millisecond latency hops at scale. Here is how we eliminated Envoy sidecars in favor of kernel-level eBPF routing with Cilium.

Share X LinkedIn

Tip: use ← / → to browse posts.

Replacing Sidecar Proxies: Bare-Metal eBPF Routing with Cilium in Production
## The Sidecar Tax Has Broken Modern Clusters For five years, the de facto standard for Kubernetes service meshes has been the sidecar proxy pattern. Inject an Envoy instance into every pod, intercept every inbound and outbound TCP socket via `iptables`, route traffic through user-space proxy logic, apply mTLS, and emit telemetry. At modest scale (dozens of pods, thousands of requests per second), the operational cost of this pattern is manageable. At enterprise scale (thousands of microservices, hundreds of thousands of pods across multi-region clusters), the sidecar model collapses under its own architectural weight. First, consider memory bloat. A well-tuned Envoy proxy consumes between 40 MB and 120 MB of RSS memory simply maintaining its local routing tables, cluster endpoints, and TLS session state. In a cluster with 5,000 running pods, you allocate 250 GB to 600 GB of RAM solely to run sidecars—before handling a single byte of application payloads. Second, look at packet path latency. An east-west request between Service A and Service B traverses the networking stack three separate times: 1. Service A socket down to Linux network stack. 2. Injected `iptables` redirect to Service A's Envoy sidecar (user-space context switch). 3. Envoy down through the host virtual ethernet (veth) pair. 4. Host routing across the overlay network to the target node. 5. Target node to Service B's veth pair. 6. `iptables` redirect into Service B's Envoy sidecar (user-space context switch). 7. Envoy proxy back down to Linux network stack and up into Service B's container socket. Each context switch between kernel space and user space incurs CPU cache invalidations, increases packet jitter, and introduces 2–5ms of pure serialization latency into the call graph. Kernel-level eBPF (Extended Berkeley Packet Filter) allows us to eliminate this entire proxy abstraction. ```yaml # Cilium L7 Network Policy enforcing mutual identity via eBPF apiVersion: "cilium.io/v2" kind: CiliumNetworkPolicy metadata: name: secure-ledger-transit namespace: core-banking spec: endpointSelector: matchLabels: app.kubernetes.io/name: ledger-api ingress: - fromEndpoints: - matchLabels: app.kubernetes.io/name: checkout-orchestrator toPorts: - ports: - port: "8443" protocol: TCP rules: http: - method: POST path: "/v3/transactions/reconcile" ``` ### The Architecture of Kernel-Level Socket Forwarding Cilium eliminates the veth-pair and user-space proxy overhead through socket-level switching (`sockops`). When two pods reside on the same Kubernetes host, Cilium’s eBPF programs hook directly into the Linux socket layer (`sock_map`). Instead of pushing the TCP packet down through the TCP/IP network stack, encapsulating it, passing it through virtual network devices, and running it back up, eBPF intercepts the packet directly at the socket level. It writes the data directly into the receiving socket's buffer queue. The kernel skips TCP encapsulation, routing lookups, and firewall rule iteration entirely. When traffic must leave the node for cross-node communication, Cilium leverages Geneve or native routing via BGP directly from kernel space, bypassing intermediate bridges and `iptables` chains entirely. ### Implementing Mutual Authentication Without Sidecars One of the most persistent objections to dropping sidecars is mTLS: "If you remove Envoy, how do you manage cryptographic identities, TLS termination, and certificate rotation?" Cilium decouples mutual authentication from the data transport path through its ambient identity model: - **Cryptographic Node Authentication**: Cross-node transport is secured using WireGuard or IPsec native kernel encryption. This runs inside the kernel at near wire-speed, drastically outperforming user-space TLS termination. - **SPIFFE/SPIRE Identity Handshake**: Pod identities are derived from SPIFFE IDs managed by Cilium agents running per-node. Before two pods communicate, the node agents perform an out-of-band mutual authentication handshake, caching the cryptographic handshake at the kernel eBPF map level. - **Zero Application Impact**: Developers write native HTTP/gRPC without mounting local certificate volumes, configuring ALPN negotiation, or managing proxy termination timeouts. ### Operational Realities and Edge Cases Moving to an eBPF-native networking architecture is not a drop-in config flip. Infrastructure teams must prepare for distinct operational challenges: - **Kernel Version Dependencies**: To run socket-level load balancing, L7 protocol parsing, and WireGuard transparent encryption concurrently, clusters must run modern Linux kernels (6.6 LTS or newer). Outdated enterprise distros will fail to verify complex eBPF programs. - **Debugging Shifts from `tcpdump` to eBPF Tracepoints**: Traditional network debugging tools (like listening on `eth0` with `tcpdump`) will deceive you because packets bypassed the IP stack entirely via `sockops`. Platform engineers must be trained in `cilium monitor`, `pwru` (Packet, Where Are You?), and kernel tracepoints. - **Memory Mapping Budgeting**: eBPF maps reside in locked kernel memory. You must tune `bpf-map-dynamic-size-ratio` to ensure the host doesn't exhaust its continuous memory allocations under heavy connection turnover. ### The Bottom Line By replacing our sidecar mesh architecture with Cilium eBPF, we achieved: - **A 74% reduction in non-workload compute overhead** across our fleet. - **P99 tail latency dropped from 18.2ms to 3.8ms** on deep microservice call graphs. - **Zero packet drops during rolling deployments**, eliminating the classic `SIGTERM` race condition common to Envoy sidecars terminating before client applications. The sidecar era was a necessary intermediate step. Kernel-native networking is the permanent replacement.
ebpf
kubernetes
cilium
devops
networking
Share X LinkedIn

What clients say

Real reviews from founders and teams we've shipped with.

5.0 · 6 reviews
"Our AI copilot streams like GPT and hits sub-200ms first token. Hashim tuned every layer."
Ines M.
Product, CopilotOne
"Our observability stack (Sentry, Axiom, Grafana) finally tells us what's actually breaking."
Adrien C.
SRE Lead, Nimbus
"A rare mix of taste and technical depth. Our domain marketplace has never looked sharper."
Michael T.
CEO, DomainsMarket24
"Broker directory that ranks and converts. The SEO foundations alone were worth it."
Rohit D.
Founder, Stock Broker of India
"A newsroom platform that actually scales. Editors love the workflow Hashim built for us."
Marco B.
Editor-in-Chief, TradeView News
"Our Next → TanStack migration cut TTFB in half. Hashim's diagnosis was surgical."
Lena K.
Staff Engineer, Northloop