Ecstaticloud
Initializing0%
Ecstaticloud Logo
Back to Insights
DevOps & SecuritySeptember 8, 2026

Zero-Trust at Scale: Implementing eBPF-Driven Security in Multi-Tenant Kubernetes Clusters

Discover how leveraging eBPF with Cilium allows cloud engineers to enforce granular network policies and real-time observability without kernel modifications or sidecar proxy overhead. Learn step-by-step how Ecstaticloud built a resilient, low-latency zero-trust architecture across multi-cloud Kubernetes deployments.

Scaling multi-tenant Kubernetes clusters to thousands of nodes and tens of thousands of workloads inevitably exposes the architectural limits of legacy Linux networking. Traditional Kubernetes CNI plugins rely heavily on iptables or IPVS for routing and network policy enforcement. As cluster size grows, iptables suffers from $O(N)$ lookup evaluation overhead, sequential rule processing, and slow updates that cause noticeable control-plane lag during pod churn.

To solve this, many organizations turn to service meshes like Istio or Linkerd to enforce Zero-Trust (L7 security, mTLS, fine-grained access control). However, inserting an Envoy sidecar container into every single pod introduces a steep operational tax: excessive CPU and memory consumption, increased cold-start times, and measurable p99 latency overhead on every network hop.

At Ecstaticloud, we engineered a resilient, high-throughput, multi-tenant Zero-Trust architecture that bypasses both the legacy iptables bottleneck and the sidecar resource tax. The key lies in eBPF (Extended Berkeley Packet Filter) powered by Cilium.


1. The Paradigm Shift: Why eBPF Beats Legacy Networking & Sidecars

eBPF allows sandboxed, event-driven programs to run directly inside the Linux kernel without modifying kernel source code or loading dynamic kernel modules. By hooking directly into packet processing points such as Traffic Control (tc), socket operations (sock_ops), and XDP (eXpress Data Path), eBPF transforms the Linux kernel into a programmable, high-performance packet processing engine.

+-----------------------------------------------------------------------+
|                             USER SPACE                                |
|                                                                       |
|   +------------------+                    +------------------+        |
|   |   Tenant Pod A   |                    |   Tenant Pod B   |        |
|   +--------+---------+                    +--------^---------+        |
|            | Socket Communication (Bypassed)       |                  |
|            +---------------------------------------+                  |
+------------|---------------------------------------|------------------+
|            v                                       |                  |
|   +------------------------------------------------+--------------+   |
|   |                  eBPF / Cilium Sockmap                        |   |
|   |         (Direct Socket-to-Socket Local Transport)             |   |
|   +---------------------------------------------------------------+   |
|                                                                       |
|                        LINUX KERNEL SPACE                             |
+-----------------------------------------------------------------------+

Key Differences at a Glance

| Feature | Legacy iptables | Sidecar Proxy (Envoy) | Cilium eBPF | | :--- | :--- | :--- | :--- | | Lookup Efficiency | $O(N)$ Sequential search | $O(1)$ Proxy routing | $O(1)$ Hash Map Lookups | | Resource Overhead | Low CPU, high kernel state | High (100MB+ RAM & CPU per pod) | Minimal (Agent per node) | | Kernel Stack Processing | Full TCP/IP stack evaluation | Full TCP/IP stack (x2 via loopback) | Short-circuited at socket layer | | L7 Security Visibility | None (L3/L4 only) | Rich L7 policies | Rich L7 policies (eBPF + host proxy) | | Policy Update Latency | Seconds to Minutes (lock contention) | Fast (xDS push) | Milliseconds (eBPF map updates) |

By leveraging sockmap and sk_msg eBPF program types, Cilium short-circuits socket communication for local pods on the same node. Instead of forcing packets down through the device drivers, IP layer, TCP stack, loopback, and back up, Cilium redirects payloads directly from the sender’s socket buffer to the receiver’s socket buffer inside kernel space.


2. Multi-Tenant Zero-Trust Architectural Blueprint

To achieve true multi-tenancy at scale, we enforce Identity-Based Security instead of IP-based security. In dynamic Kubernetes environments, IP addresses are ephemeral and inherently untrusted.

Cilium assigns a cryptographically stable Security Identity (a 24-bit numeric ID) to pods based on metadata labels. Security policies are evaluated against these numeric identities via ultra-fast eBPF map lookups (cilium_auth_map, cilium_policies) rather than parsing changing IP ranges.

                         +-----------------------------+
                         |    Cilium Control Plane     |
                         |  (Security Identity Alloc)  |
                         +--------------+--------------+
                                        |
                  +---------------------+---------------------+
                  |                                           |
                  v                                           v
       +-----------------------+                   +-----------------------+
       |   Tenant Alpha Node   |                   |    Tenant Beta Node   |
       |  Identity: 10452       |                   |  Identity: 20891       |
       |                       |   Cross-Node      |                       |
       | +-------------------+ |   Encrypted       | +-------------------+ |
       | |  Pod: Order-Svc   | |   WireGuard Mesh  | |  Pod: Payment-Svc | |
       | +---------+---------+ | <===============> | +---------^---------+ |
       |           |           |                   |           |           |
       |      [eBPF TC Hook]   |                   |      [eBPF TC Hook]   |
       +-----------|-----------+                   +-----------|-----------+
                   +-------------------------------------------+

Core Architecture Pillars

  1. Host-Routing Optimization: Bypassing iptables entirely using eBPF host routing (bpf-lb-external-clusterip).
  2. Kube-Proxy Replacement: Direct execution of Kubernetes Service load balancing via eBPF maps.
  3. Transparent Network Encryption: Node-to-node and pod-to-pod encrypted overlays using WireGuard (managed via eBPF in kernel space).
  4. Hard Isolation Boundaries: Strict egress and ingress default-deny postures for every tenant namespace.

3. Hands-On Implementation Strategy

Let's dive into deploying and configuring this setup on a high-density, multi-tenant Kubernetes deployment.

Step 1: Deploying Cilium with Kube-Proxy Replacement

To eliminate iptables completely, deploy Cilium using Helm with kubeProxyReplacement set to true and enable eBPF host routing.

Save the following values configuration as cilium-values.yaml:

# cilium-values.yaml
ciliumEndpointCRD: true
cluster:
  name: ecstaticloud-prod-us-east
  id: 1

# Complete Kube-Proxy replacement via eBPF
kubeProxyReplacement: true
k8sServiceHost: "10.0.0.1"  # Replace with actual API Server VIP/DNS
k8sServicePort: "6443"

# Optimization flags
bpf:
  masquerade: true
  preallocateMaps: true
  clockProbe: true

# Enable transparent node-to-node and pod-to-pod WireGuard encryption
encryption:
  enabled: true
  type: wireguard

# Enable native eBPF host routing (bypasses iptables and veth pair bottlenecks)
bpfHostRouting: true
ipam:
  mode: "kubernetes"

# Real-time network observability engine
hubble:
  enabled: true
  metrics:
    enabled:
      - dns:query;ignoreAAAA
      - drop
      - tcp
      - flow
      - icmp
      - http
  relay:
    enabled: true
  ui:
    enabled: true

# Advanced L7 parsing support
l7Proxy: true

Install Cilium into the cluster:

helm repo add cilium https://helm.cilium.io/
helm repo update

helm upgrade --install cilium cilium/cilium \
  --namespace kube-system \
  --values cilium-values.yaml

Verify that eBPF native host routing and replacement are operational:

kubectl -n kube-system exec -it ds/cilium -- cilium status --verbose | grep -E "KubeProxyReplacement|BPF Host Routing"

Step 2: Enforcing Identity-Based Microsegmentation

In a multi-tenant environment hosting tenant-alpha and tenant-beta, workloads in tenant-alpha must never communicate with tenant-beta unless explicitly permitted.

Here is a comprehensive CiliumNetworkPolicy (CNP) that applies strict L3, L4, and L7 rules. It permits the checkout service in tenant-alpha to talk to the payment service in tenant-beta only over HTTPS on port 8443, restricted specifically to POST /v2/charge.

apiVersion: "cilium.io/v2"
kind: CiliumNetworkPolicy
metadata:
  name: enforce-tenant-cross-boundary-secure
  namespace: tenant-beta
spec:
  endpointSelector:
    matchLabels:
      app: payment-service
      tenant: beta
  ingress:
  # Allow ingress traffic exclusively from designated Tenant Alpha pod identities
  - fromEndpoints:
    - matchLabels:
        app: checkout-service
        tenant: alpha
        io.kubernetes.pod.namespace: tenant-alpha
    toPorts:
    - ports:
      - port: "8443"
        protocol: TCP
      rules:
        # Deep Packet Inspection via eBPF-orchestrated Envoy filters at L7
        http:
        - method: "POST"
          path: "/v2/charge"
  egress:
  # Strict egress lockdown: tenant pods can only communicate with cluster-internal DNS
  - toEndpoints:
    - matchLabels:
        k8s:io.kubernetes.pod.namespace: kube-system
        k8s-app: kube-dns
    toPorts:
    - ports:
      - port: "53"
        protocol: UDP
      rules:
        dns:
        - matchPattern: "*"

Apply the policy:

kubectl apply -f enforce-tenant-cross-boundary-secure.yaml

Step 3: Runtime Process and Kernel Observability with Tetragon

Network-level policies secure wire communication, but Zero-Trust requires runtime execution security inside the container itself. If a container in tenant-alpha suffers a Remote Code Execution (RCE) vulnerability, network policies alone won't stop an attacker from executing shell payloads or inspecting host namespaces.

We integrate Tetragon (eBPF-based security visibility and enforcement) to intercept syscalls directly in the kernel before execution completes.

The following TracingPolicy blocks any process executing unauthorized binaries (e.g., nc, nmap, or dynamic reverse shells) inside tenant namespaces in real-time:

apiVersion: cilium.io/v1alpha1
kind: TracingPolicy
metadata:
  name: block-exec-recon-tools
  namespace: tenant-alpha
spec:
  kprobes:
    - call: "sys_execve"
      syscall: true
      args:
        - index: 0
          type: "string" # Path to binary executed
      selectors:
        - matchArgs:
            - index: 0
              operator: "In"
              values:
                - "/usr/bin/nc"
                - "/usr/bin/nmap"
                - "/bin/netcat"
          matchActions:
            - action: Sigkill # Immediately kill the process at kernel level

Apply this policy to automatically trigger SIGKILL events whenever restricted processes run inside designated tenant workloads:

kubectl apply -f block-exec-recon-tools.yaml

4. Real-Time Deep Observability with Hubble

One major friction point with classic Zero-Trust models is diagnosing dropped connections without deploying intrusive packet capture utilities (tcpdump). Cilium addresses this with Hubble, providing structured visibility directly from eBPF ring buffers.

To observe dropped packets across multi-tenant boundaries in real-time using the Hubble CLI:

# Filter for dropped traffic across tenant namespaces
hubble observe --namespace tenant-alpha \
  --verdict DROP \
  --follow \
  --output compact

Example JSON-formatted observability stream emitted directly from the eBPF kernel program without user-space round-trips:

{
  "flow": {
    "time": "2026-03-30T10:14:02.102938102Z",
    "verdict": "DROPPED",
    "drop_reason": "POLICY_DENIED",
    "auth_type": "DISABLED",
    "traffic_direction": "INGRESS",
    "identity": 10452,
    "source": {
      "namespace": "tenant-alpha",
      "pod_name": "malicious-recon-pod-7db4f5b89-x8j2l",
      "labels": ["app=recon", "tenant=alpha"]
    },
    "destination": {
      "namespace": "tenant-beta",
      "pod_name": "payment-service-58999885-vslq2",
      "labels": ["app=payment-service", "tenant=beta"]
    },
    "l4": {
      "tcp": {
        "source_port": 49152,
        "destination_port": 22
      }
    }
  }
}

5. Sizing & Performance Benchmarks at Scale

During our production stress-testing across multi-cloud environments, we benchmarked standard iptables CNI setups, Istio Sidecar architecture, and Cilium eBPF Host Routing.

Latency Comparison (p99 Latency under heavy load)

        Latency (ms) - Lower is better
        +-------------------------------------------------------+
iptables| =========================================== 14.2ms    |
Istio   | ================================================= 16.8ms|
eBPF    | ====== 2.1ms                                          |
        +-------------------------------------------------------+

Resource Consumption (Per 1000 Pods)

  • Istio Sidecar Architecture: ~100 GB RAM / ~12 vCPUs dedicated exclusively to Envoy proxy sidecars.
  • Cilium eBPF Architecture: ~3.5 GB RAM / ~1.2 vCPUs dedicated to single cilium-agent DaemonSet instances per node.

Production Kernel & BPF Map Sizing Tuning Guidelines

To avoid dynamic map overflow errors in high-density multi-tenant environments (e.g., clusters running over 100,000 endpoint identities), ensure the following sysctls and Cilium BPF map configurations are applied:

# Add to cilium-values.yaml under 'bpf' for high-scale clusters
bpf:
  # Scale map capacity dynamically according to node memory size
  mapDynamicSizeRatio: 0.0055
  
  # Fine-tune explicit max entries for massive scale environments
  policyMapMax: 16384
  ctMapMax: 1048576       # Connection tracking map entries
  ipMapMax: 524288        # IP to Identity translation cache

Required Kernel Boot Parameters (sysctl):

# Enforce sufficient memory limits for locked memory required by eBPF maps
net.core.bpf_jit_enable = 1
net.core.bpf_jit_harden = 2
vm.max_map_count = 262144

Conclusion: True Zero-Trust Without Compromise

Achieving production Zero-Trust security in multi-tenant Kubernetes doesn't require accepting heavy latency penalties or bloated node resource bills. By pushing networking, policy enforcement, and operational observability down into the Linux kernel using eBPF and Cilium, Ecstaticloud built an enterprise-grade multi-tenant architecture that scales effortlessly.

Key Key Takeaways

  1. Eliminate Legacy Overhead: Replace kube-proxy and iptables to achieve $O(1)$ packet routing performance regardless of cluster growth.
  2. Sidecarless Security: Secure L3 through L7 application layers cleanly without injecting Envoy sidecars into application pods.
  3. Identity Over IPs: Enforce isolation using stable, metadata-derived Security Identities rather than fragile IP subnet boundaries.
  4. Deep Kernel Observability: Unify network enforcement with process execution tracking using Cilium, Hubble, and Tetragon for complete end-to-end security.