Free — no signup required

eBPF Security in Kubernetes: The Full Picture

2 min read

eBPF-based security tools integrate deeply with Kubernetes, enriching kernel-level events with pod, namespace, and workload metadata. This is critical because a raw kernel event like "PID 4821 opened /etc/shadow" is useless without knowing that PID 4821 belongs to the payment-service pod in the production namespace running image mycompany/payment:v2.3.1.

How Kubernetes Metadata Enrichment Works

When a container starts, the container runtime (containerd, CRI-O) creates a new Linux namespace and cgroup for it. The eBPF tool's user-space daemon watches for these events (via the container runtime's API or by monitoring cgroup creation) and builds a map of {cgroup_id → pod metadata}. When a kernel event fires, the eBPF program reads the current process's cgroup ID and the user-space daemon enriches the event with the corresponding Kubernetes metadata.

This is why Falco rules can reference k8s.pod.name and k8s.ns.name even though the kernel knows nothing about Kubernetes.

Defense in Depth: Layering eBPF with Other Controls

eBPF security tools are one layer in a defense-in-depth strategy, not a replacement for other controls:

Layer Tool What It Enforces
Image scanning Trivy, Grype Known CVEs in container images
Admission control OPA/Gatekeeper, Kyverno Pod spec policy (no privileged containers, etc.)
Network policy Cilium, Calico Which pods can talk to which
Runtime detection Falco Anomalous behavior alerts
Runtime enforcement Tetragon Block/kill on policy violation
Audit logging auditd, cloud audit logs Compliance evidence trail

eBPF tools (Falco, Tetragon) operate at the runtime layer — they catch attacks that bypassed all the preventive controls above. An attacker who exploits a zero-day in your application will bypass image scanning and admission control. eBPF is your last line of detection and enforcement.

Interview Tip

Interviewers often ask: "If you have network policies and image scanning, why do you need runtime security?" The answer: preventive controls fail against zero-days, supply chain attacks (malicious code in a legitimate image), and insider threats. Runtime security (Falco/Tetragon) detects behavioral anomalies — a web server spawning a shell, a database process making outbound connections — that are invisible to static analysis. It's the difference between checking IDs at the door and having security cameras inside the venue.

This is one of 18 chapters

Every chapter is free — Kubernetes, Terraform, SRE, distributed systems, and more — with fast daily review built in.

Sign up free