Polyaxon v3 is coming →

BTF for portable eBPF observability

Understand how BPF Type Format supports eBPF introspection, CO-RE portability, safer deployment, and kernel-level observability for ML infrastructure.

September 18, 2025by Polyaxon
BTF for portable eBPF observability

BPF Type Format, or BTF, stores compact type and source metadata for eBPF programs and Linux kernel types. It improves introspection and enables CO-RE—Compile Once, Run Everywhere—to adapt compiled eBPF programs to compatible kernel type layouts at load time.

For ML infrastructure, eBPF can provide low-level evidence about networking, scheduling, system calls, storage, and process behavior without modifying every workload. BTF makes those programs easier to distribute, but it does not remove kernel compatibility, security, or operational risk.

Understand what BTF contains

The Linux kernel's BTF documentation defines compact metadata for types, strings, functions, variables, data sections, and source-line information.

In an eBPF ELF object:

  • .BTF contains types and strings;
  • .BTF.ext can contain function, line, and relocation information;
  • kernel BTF is commonly exposed at /sys/kernel/btf/vmlinux when supported and enabled.

BTF is intentionally smaller and simpler than general-purpose debugging formats. Tools can use it to display readable map values, inspect program types, and relate compiled access to the target kernel.

Check the actual node rather than assuming an operating-system image includes BTF:

uname -r
test -r /sys/kernel/btf/vmlinux
bpftool btf dump file /sys/kernel/btf/vmlinux format c

Tool availability and permission requirements vary. Run inspection through an approved administrative workflow, not from arbitrary workload Pods.

See why kernel portability is difficult

eBPF programs can read kernel structures whose layout differs across kernel versions, configurations, and vendors. A field can move, change type, be renamed, or disappear. Compiling against one machine's headers and assuming fixed offsets is unsafe.

Older workflows often compiled on the target using its headers. That increases package size, startup work, and dependency on matching build material. CO-RE moves much of that adaptation to load time.

BTF describes the compiled program's type expectations and the target kernel's actual types. A loader such as libbpf can apply relocations for field offsets and compatible type changes. This improves portability across supported kernels without promising universal compatibility.

Treat CO-RE as compatibility engineering

CO-RE still needs a defined support matrix. Programs can depend on helpers, attach points, map types, verifier behavior, kernel configuration, and features that BTF cannot emulate.

Before deployment:

  1. define supported kernel versions and distributions;
  2. verify target BTF availability and required kernel features;
  3. test program loading and behavior on representative nodes;
  4. fail closed or disable collection when assumptions are unmet;
  5. record program, loader, kernel, and configuration versions;
  6. canary changes before a cluster-wide rollout.

A program that loads successfully may still produce misleading data if its semantic assumptions changed. Validate measurements against known workloads.

Use eBPF for the right observability gaps

eBPF is useful when the required evidence exists below application instrumentation or across many heterogeneous processes. Examples include:

  • network connection, latency, retransmission, and DNS behavior;
  • process execution and selected system calls;
  • file and block-I/O latency;
  • CPU scheduling and off-CPU time;
  • container and Kubernetes identity enrichment;
  • security-relevant kernel activity.

It does not know that a training loss is improving, a model response is grounded, or an artifact is acceptable. Correlate kernel signals with application telemetry and Polyaxon run context.

Prefer standard metrics, logs, traces, and application instrumentation when they answer the question safely. Kernel instrumentation should close a specific visibility gap, not collect everything because it can.

Secure cluster-wide deployment

eBPF collectors often need host-level access, Linux capabilities, privileged mounts, or kernel interfaces. A DaemonSet can therefore expand the blast radius across every node.

Review program provenance, signatures, image digests, privileges, attach points, data collection, update mechanism, and failure behavior. Limit access to maps and exported telemetry. Treat captured process, network, and file metadata as potentially sensitive.

Use admission policy and dedicated namespaces or nodes where appropriate. Separate the ability to query exported observations from the ability to load new programs into the kernel.

Bound overhead and telemetry volume

Measure CPU, memory, map usage, event loss, network export, and storage cost under representative load. High-frequency hooks can create significant overhead or data volume even when each event is small.

Aggregate in the kernel or collector when the loss of detail is acceptable. Sample deliberately, cap map sizes, and expose dropped-event counters. An absent event should not be interpreted as proof that an action never happened when buffers overflowed.

Monitor the collector and loader themselves. A kernel upgrade that disables an attach point or invalidates a program can silently remove an important signal unless compatibility and data freshness are checked.

Connect kernel evidence to ML operations

Polyaxon platform observability supplies service and workload context above the node. Run logging and tracked metadata connect low-level symptoms to the operation, project, resources, code, and artifacts involved.

Use bounded labels such as cluster, namespace, workload class, node pool, and device type for aggregation. Keep unique run identifiers in a correlation store or trace rather than unbounded metric dimensions.

BTF makes eBPF programs more inspectable and portable across supported kernels. The reliable operating model still requires a compatibility matrix, least privilege, canary deployment, overhead measurement, and correlation with the ML outcome the platform is trying to explain.