29 November 2026 · 2 min read · Download as PDF

eBPF explained: tiny programs inside the Linux kernel

eBPF lets you load small, checked programs into the running Linux kernel without changing it or rebooting. How it works (the verifier, hooks and maps), where you meet it in Kubernetes with Cilium, and a one-line bpftrace program to try.

Cover: eBPF explained: tiny programs inside the Linux kernel

eBPF lets you run small programs inside the running Linux kernel, without changing the kernel's code or rebooting. Before a program runs, the kernel checks it and refuses anything it can't prove safe. That one idea powers a lot of modern infrastructure: Kubernetes networking with Cilium, observability tools that trace every request, and security tools that watch what every process does. You can try it yourself with a single line of bpftrace.

TL;DR

  • What: small programs loaded into the kernel at run time, triggered by events such as a system call or a network packet.
  • Checked: the kernel's verifier rejects any program it can't prove safe: no invalid memory access, no endless loops.
  • Results: programs share data with ordinary programs through maps.
  • Where you meet it: Cilium (Kubernetes networking), tracing tools, runtime security tools.
  • Try it: a bpftrace one-liner that prints the files programs open, live.

How an eBPF program runs

How an eBPF program runs inside the kernel. In user space, your eBPF program, from bpftrace, Cilium or a tracing or security tool, is loaded into the Linux kernel. There the verifier checks it first: no crashes, no endless loops. It is attached to a hook: a system call, a network packet, a function. It writes to maps, data shared with user space, and the user-space side reads the results: counts, file names, network flows. No kernel change, no reboot: load it, use it, unload it.
  1. Load. A tool in user space loads a small eBPF program into the kernel.
  2. Verify. The kernel's verifier checks the program can't access memory it shouldn't or loop forever. If it can't prove that, the program is refused.
  3. Attach. The program is attached to a hook: a system call, a tracepoint, a kernel function, or a point in the network path where packets arrive.
  4. Share. Each time the hook fires, the program runs and can write to maps, data structures that user space can read.

When you're done, unload it. Nothing in the kernel changed permanently, and nothing needed a reboot.

Where you meet eBPF

  • Kubernetes networking: Cilium uses eBPF to route and filter traffic between Pods and to enforce network policies. The project marked ten years in 2026.
  • Observability: tracing tools use it to see which functions and system calls a program makes, in production, at low cost.
  • Security: runtime security tools use it to watch which processes start, which files they open and where they connect.
  • Even scheduling: with sched_ext, CPU schedulers themselves can be written as eBPF programs.

Try it: watch files being opened

On a Linux machine, install bpftrace (for example sudo apt install bpftrace) and run:

Shell
sudo bpftrace -e 'tracepoint:syscalls:sys_enter_openat { printf("%s %s\n", comm, str(args.filename)); }'

Every time a program opens a file through openat, the system call most programs use, you see the program's name and the file. Press Ctrl+C to stop, and the program is unloaded. To list the tracepoints you could attach to:

Shell
sudo bpftrace -l 'tracepoint:syscalls:*open*'

Tracing programs like this one need root, or the right capabilities, because they can see every process on the machine.

Common questions

Is eBPF the same as a kernel module?

No. A kernel module can do anything, including crash the kernel. An eBPF program is checked by the verifier first and can only use what the kernel allows it to.

Do I need eBPF for the CKA or CKAD?

No, but you meet it whenever a cluster uses Cilium, and it helps to know what's happening underneath.

Keep going

This article goes with day 7 of The 12 Days of Tech-mas, our short video series of twelve tech gifts that aren't AI news.

More from the blog