L17. Runtime Security: Falco, Tetragon and eBPF
Course outlineLesson 17 of 18
Prevention controls fail. Runtime security detects anomalous behavior inside running containers: unexpected process execution, file access, network connections, and privilege escalation.
Why Runtime Security?
All the controls covered so far (RBAC, Pod Security Standards, Network Policies, image scanning) are preventive. They reduce the attack surface but they do not guarantee that exploitation or misuse is prevented. Combine prevention with behavioral detection and response.
Runtime security monitors container behavior and alerts on anomalies: a web server spawning a shell, a database process opening a network connection to an external IP, or a container writing to a sensitive host path.
eBPF: The Foundation
eBPF (extended Berkeley Packet Filter) is a Linux kernel technology that allows running sandboxed programs inside the kernel without modifying kernel source code or loading kernel modules. Runtime security tools use eBPF to observe system calls, network traffic, and file access with minimal performance overhead.
Falco
Falco is a CNCF runtime security project. It monitors system calls and generates alerts based on rules:
- rule: Protego shell execution in container
desc: A shell was spawned in a container
condition: >
spawned_process and container and
proc.name in (bash, sh, zsh, dash)
output: >
Shell spawned in container
(user=%user.name container=%container.name
image=%container.image.repository
command=%proc.cmdline)
priority: WARNING
tags: [container, shell]Falco can detect:
- Shell execution in production containers
- Sensitive file reads (/etc/shadow, /etc/passwd)
- Outbound connections to known C2 IPs
- Privilege escalation attempts
- Unexpected process trees
Deploy Falco on an owned lab cluster with compatible Linux nodes. Install Helm and kubectl first and confirm the target context. The Helm chart deploys a privileged DaemonSet; verify kernel/driver prerequisites before choosing modern_ebpf:
helm repo add falcosecurity https://falcosecurity.github.io/charts
helm repo update
helm install falco falcosecurity/falco --namespace falco --create-namespace \
--set driver.kind=modern_ebpf \
--set falcosidekick.enabled=trueFalcosidekick supports forwarding alerts to external systems once you configure an output. Check readiness with kubectl get pods -n falco and confirm delivery of a benign test alert before relying on it.
Tetragon
Tetragon (from the Cilium project) provides eBPF-based observation and enforcement. First observe matching events without killing processes. This example follows the upstream fd_install argument schema:
apiVersion: cilium.io/v1alpha1
kind: TracingPolicy
metadata:
name: observe-etc-files
spec:
kprobes:
- call: "fd_install"
syscall: false
args:
- index: 0
type: int
- index: 1
type: file
selectors:
- matchArgs:
- index: 1
operator: Prefix
values: ["/etc/"]This observation-only example inspects the file argument at index 1, not the integer file descriptor at index 0. It reports matching file-descriptor installations, not just writes. Install Tetragon and its CRDs first; save the example as observe-etc.yaml and apply it in an owned lab with kubectl apply -f observe-etc.yaml. Generate a benign read of /etc/hosts, inspect the resulting event, and remove the policy with kubectl delete -f observe-etc.yaml.
For enforcement, Tetragon supports selector matchActions such as Sigkill. Killing a process does not guarantee that an operation had no side effects; hook selection, scope, and bypasses matter. The upstream fd_install example explicitly warns that path matching can be bypassed through hard links. Test enforcement and rollback in a disposable environment before applying it to production workloads.
Comparison
| Feature | Falco | Tetragon |
|---|---|---|
| Primary mode | Detection/alerting | Detection + enforcement |
| eBPF support | Yes (modern_ebpf driver) | Native eBPF |
| Rule language | YAML with condition syntax | TracingPolicy CRDs |
| Real-time blocking | No (alert only) | Yes (Sigkill, Signal) |
| Community | CNCF graduated project | Cilium/Isovalent project |
Building a Detection Strategy
- Start with Falco's default ruleset in alert-only mode
- Tune rules to reduce false positives in your environment
- Integrate alerts with your SIEM or incident response platform
- Gradually add Tetragon enforcement policies for high-confidence rules
- Measure event loss, CPU/memory overhead, and workload latency under representative load; overhead depends on event volume and policy scope
Continue Learning
Correlate runtime alerts with Kubernetes audit logs to build an incident timeline.
References
- ✓Preventive controls reduce attack surface; runtime detection adds visibility into misuse and suspicious behavior in running containers
- ✓eBPF allows observing system calls, network traffic, and file access at the kernel level with minimal performance overhead
- ✓Falco is detection-focused: it monitors syscalls and generates alerts based on YAML rules
- ✓Tetragon can enforce policies in real time by killing processes that violate rules (Sigkill action)
- ✓Start with Falco default rules in alert-only mode, tune for false positives, then add Tetragon enforcement for high-confidence rules
1. What is the key difference between Falco and Tetragon?
2. What Linux technology enables runtime security tools to observe system calls with minimal overhead?
3. Which Falco rule condition detects a shell being spawned inside a container?