<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Ebpf on lo0 — Tech Blog</title><link>https://blog.lo0.es/en/tags/ebpf/</link><description>Recent content in Ebpf on lo0 — Tech Blog</description><generator>Hugo -- gohugo.io</generator><language>en</language><lastBuildDate>Thu, 18 Jun 2026 11:00:00 +0200</lastBuildDate><atom:link href="https://blog.lo0.es/en/tags/ebpf/index.xml" rel="self" type="application/rss+xml"/><item><title>How we use our infrastructure to meet defence standards with AI</title><link>https://blog.lo0.es/en/posts/infrastructure-defence-ai-compliance/</link><pubDate>Thu, 18 Jun 2026 11:00:00 +0200</pubDate><guid>https://blog.lo0.es/en/posts/infrastructure-defence-ai-compliance/</guid><description>&lt;p>In defence, the challenge of putting AI into operation is not the model: it is security and compliance. The rules that apply, the allied interoperability standards, the data-centric security rules, the accreditation frameworks and the principles of responsible use, impose concrete requirements on access control, classification, confidentiality, traceability, supply chain and sovereignty. A demo on a laptop connected to the internet ignores all of that; an operable platform has to satisfy it, and has to be able to prove it to an accreditation body.&lt;/p>
&lt;p>This article is not a tour of technologies. It is the opposite: we take the requirements imposed by the standards of the sector and, for each one, we show how our infrastructure is used to meet it. The infrastructure is the same real platform we use in other sectors, two RKE2 clusters (Kubernetes v1.35) with Cilium as the network, GitOps with Flux, Keycloak as the identity server, inference on our own GPUs and, in pre-production, scheduling with Volcano, adapted to an environment with stricter security requirements. Every component is here because it solves a regulatory requirement, not because it looks good on a diagram. And, like all infrastructure, it is measured by efficiency and cost, which is what makes compliance sustainable.&lt;/p>
&lt;p>It is worth starting with an idea many people are unaware of: &lt;strong>standards for this already exist in the sector&lt;/strong>, and nothing has to be invented. There are allied interoperability standards, there is a defence-specific DevSecOps reference model on Kubernetes, there is a security framework (Zero Trust) and a supplier accreditation scheme, and there is a body of principles for the responsible use of military AI. Let us first lay out that map, and then walk the requirements one by one.&lt;/p>
&lt;h2 id="the-map-of-standards-in-the-sector">The map of standards in the sector&lt;/h2>
&lt;p>Four families of standards intersect in a defence AI platform, and understanding what each one covers avoids reinventing wheels.&lt;/p>
&lt;p>&lt;strong>Allied interoperability.&lt;/strong> In a coalition, systems have to understand each other. &lt;strong>Federated Mission Networking (FMN)&lt;/strong> defines how mission networks are federated across nations through successive &amp;ldquo;spirals&amp;rdquo;; the &lt;strong>MIP (Multilateral Interoperability Programme)&lt;/strong> and its JC3IEDM data model standardise command and control; Link-16 and formats such as NVG (NATO Vector Graphics) cover tactical and situational exchange. They are, in defence, the equivalent of what FHIR and DICOM are in healthcare: the common language without which AI is an isolated system that cannot be integrated into the operation.&lt;/p>
&lt;p>&lt;strong>Data-centric security: STANAG 4774 and 4778.&lt;/strong> This is the most distinctive piece of the sector. &lt;strong>STANAG 4774&lt;/strong> defines the syntax of a &lt;strong>confidentiality label&lt;/strong> (policy, classification, security categories), and &lt;strong>STANAG 4778&lt;/strong> defines the &lt;strong>binding mechanism&lt;/strong> that ties that label to the data throughout its whole life cycle and between the parties that share it. Instead of protecting only the perimeter or the system, the information object itself is protected: the classification travels with the data and the access decision is taken against the label. Both STANAGs are in the process of ratification by the nations and are moving from recommended practice to a requirement for mission-critical software.&lt;/p>
&lt;p>&lt;strong>Defence DevSecOps on Kubernetes.&lt;/strong> To build and deploy defence software there is a very concrete reference model: the &lt;strong>DoD Enterprise DevSecOps Reference Design&lt;/strong> on Kubernetes, embodied in platforms such as &lt;strong>Platform One&lt;/strong> and its &lt;strong>Big Bang&lt;/strong> product line (declarative continuous delivery of hardened packages on a Kubernetes cluster), supported by &lt;strong>Iron Bank&lt;/strong>, the repository of &lt;strong>hardened container images compliant with the DISA STIGs&lt;/strong>, continuously scanned. The associated philosophy is &lt;strong>cATO (Continuous Authority To Operate)&lt;/strong>: accreditation stops being a one-off milestone and becomes a state maintained through continuous monitoring. For defence, it is the equivalent of the Kubernetes-native standard that MONAI represents in medical imaging: an agreed way to package and operate software with guarantees about the substrate we already use.&lt;/p>
&lt;p>&lt;strong>Security and accreditation frameworks.&lt;/strong> The &lt;strong>DoD Zero Trust Reference Architecture&lt;/strong> (v2.0) sets the guiding principle, do not trust by default, always verify, with adoption targets towards 2027. Supplier accreditation is governed by &lt;strong>CMMC 2.0&lt;/strong> (whose Phase 2, with mandatory third-party certification for level 2, arrives in November 2026) over the 110 controls of &lt;strong>NIST SP 800-171&lt;/strong>. In Spain and the EU, the &lt;strong>Esquema Nacional de Seguridad&lt;/strong> (the Spanish National Security Framework) at high category and the &lt;strong>CCN-STIC&lt;/strong> guides of the Centro Criptológico Nacional (the Spanish National Cryptologic Centre) play an equivalent role for systems handling sensitive or classified information.&lt;/p>
&lt;p>&lt;strong>Responsible AI in defence.&lt;/strong> NATO adopted six &lt;strong>Principles of Responsible Use (PRU)&lt;/strong> for AI in defence: lawfulness, responsibility and accountability, explainability and traceability, reliability, governability and bias mitigation, reinforced by its AI Strategy revised in 2024 and by the &lt;strong>DARB (Data and AI Review Board)&lt;/strong>. An important legal nuance: the EU &lt;strong>AI Act expressly excludes&lt;/strong> (art. 2.3) AI systems intended exclusively for military, defence or national security purposes. That is, in defence the responsible AI framework is not the AI Act, but NATO&amp;rsquo;s PRU, national rules and, as a management system, ISO/IEC 42001.&lt;/p>
&lt;p>With this map on the table, let us walk the requirements.&lt;/p>
&lt;h2 id="requirement-coalition-interoperability-fmn-mipjc3iedm">Requirement: coalition interoperability (FMN, MIP/JC3IEDM)&lt;/h2>
&lt;p>In an allied operation, a system that does not integrate is useless however good it is. The requirement, derived from FMN, from the command and control data model (MIP/JC3IEDM) and from the tactical formats (Link-16, NVG), is that AI must consume and produce information in the common formats of the coalition, not in a dialect of its own.&lt;/p>
&lt;p>How we meet it: just as in other sectors we put an interoperability layer at the boundary, here the platform integrates through the agreed &lt;em>gateways&lt;/em> and formats, so that AI never talks directly to the mission systems but consumes and delivers information already normalised to the coalition standard. This keeps AI as a component that couples into the federated architecture, respecting its profiles and its data governance, instead of a silo that forces bespoke integrations at every deployment. Interoperability is also a precondition for traceability and labelling: only if the data enters and leaves in a known format can its confidentiality label be attached and preserved.&lt;/p>
&lt;h2 id="requirement-do-not-trust-by-default-zero-trust-and-verified-access-dod-zt-ra-nist-800-171">Requirement: do not trust by default, Zero Trust and verified access (DoD ZT RA, NIST 800-171)&lt;/h2>
&lt;p>The guiding principle of modern defence security is Zero Trust: no entity, user, service or node, is trusted because of its position in the network; every access is authenticated, authorised and continuously verified. NIST 800-171 details the access and identification controls that underpin it.&lt;/p>
&lt;p>How we meet it: a single identity server, &lt;strong>Keycloak&lt;/strong>, governs authorisation with OAuth 2.1 and OpenID Connect, issuing short-lived tokens and binding them to their recipient with audience validation (&lt;code>aud&lt;/code>), so that a credential issued for one service is useless against another. Between components handling sensitive information we require &lt;strong>mutual TLS (mTLS)&lt;/strong>: it is not only the user or the service that is authenticated, but the workload itself taking part in the exchange. And the network operates in &lt;strong>default-deny&lt;/strong> (next section), so that connectivity is not a right conferred by being inside the cluster, but an explicit permission. Workloads use &lt;em>service accounts&lt;/em> with no permissions by default, and administrator access to the Kubernetes API is federated against Keycloak over OIDC with scoped roles: technical access too is authenticated, limited and audited. Zero Trust is not a product you buy; it is a property that emerges from strong identity, least privilege and continuous verification, and that is how the platform is built. Verification, moreover, does not stop at sign-in: tokens are short-lived and are renewed, policies are re-evaluated on every request, and the posture of each workload, signed image, applied security policy, determines whether it can run and communicate. A component that stops complying with its policy stops being able to operate; it is granted no grace period for having been inside.&lt;/p>
&lt;h2 id="requirement-data-centric-security-and-labelling-stanag-47744778">Requirement: data-centric security and labelling (STANAG 4774/4778)&lt;/h2>
&lt;p>Unlike other sectors, in defence the classification travels with the data. The requirement, derived from STANAG 4774/4778, is that every information object carries its confidentiality label and that access decisions are taken against that label, not against the system hosting it.&lt;/p>
&lt;p>How we meet it: authorisation decisions are not limited to roles, but incorporate &lt;strong>attribute-based access control (ABAC)&lt;/strong> evaluating the classification label of the data against the clearance of the requester. The policy is expressed as code and evaluated at a central decision point (a policy engine of the OPA/Open Policy Agent kind) that the application layer and the &lt;em>gateways&lt;/em> consult before serving a resource. The label, in accordance with STANAG 4774, travels with the object, and the binding under STANAG 4778 is preserved across the platform, in the object metadata in storage and in the annotations that travel with the request. For an AI agent, this means that its token gives it access to a classification level, and that data above that level is simply not handed to it, regardless of where it is stored.&lt;/p>
&lt;p>This approach embodies the classic no-read-up rule: an entity with a given clearance does not access information above its level, and the decision is taken on the object&amp;rsquo;s label, not on assumptions made by the system. When a workflow requires moving information to a lower level, a declassification or sanitisation, it is an explicit, audited step, with its own policy, never a side effect of a query. The label is preserved in the object metadata in storage and in the annotations accompanying the request, so that the STANAG 4778 binding is not lost when crossing the components of the platform.&lt;/p>
&lt;h2 id="requirement-segregation-by-mission-and-level-multitenancy-nist-800-171-ens">Requirement: segregation by mission and level (multitenancy, NIST 800-171, ENS)&lt;/h2>
&lt;p>Different missions, different classification levels and different compartments cannot share a common space without controls. The requirement: strong isolation, so that what belongs to one mission or level is not accessible from another.&lt;/p>
&lt;p>How we meet it: each mission or compartment lives in its own Kubernetes &lt;strong>namespace&lt;/strong>, with scoped RBAC, ResourceQuota and LimitRange, dedicated storage and databases per operator, not shared behind an application filter, and its own network segmentation. Identity is segregated by realm in Keycloak. The whole definition lives in Git and is reconciled by Flux (GitOps), so that segregation is declarative and auditable through change history. Where the classification level demands it, separation goes beyond the cluster: operation runs on physically distinct clusters or sites, and exchange between classification domains, when necessary, is done through controlled cross-domain solutions, not by opening a hole between namespaces. At the highest levels, each security domain can be an independent cluster with its own chain of trust, its own identities and its own governance, preventing a single control plane from spanning classifications that must never be mixed. The choice between a separate namespace, cluster or site is itself an accreditation decision: it is documented, justified according to the level and compartment, and reflected declaratively in the repository.&lt;/p>
&lt;h2 id="requirement-confidentiality-encryption-and-exfiltration-prevention-nist-800-171-ens-zero-trust">Requirement: confidentiality, encryption and exfiltration prevention (NIST 800-171, ENS, Zero Trust)&lt;/h2>
&lt;p>NIST 800-171 (system and communications protection families) and the ENS require confidentiality, encryption of communications and prevention of information leakage. In defence, exfiltration is not an abstract risk: it is the adversary&amp;rsquo;s objective.&lt;/p>
&lt;p>How we meet it: the network is managed by &lt;strong>Cilium&lt;/strong> (eBPF) with a &lt;strong>default-deny&lt;/strong> model. A pod has no connectivity beyond what a policy grants it explicitly, flow by flow, which turns exfiltration into something blocked in the kernel. A component can only talk to strictly necessary destinations:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-yaml" data-lang="yaml">&lt;span class="line">&lt;span class="cl">&lt;span class="nt">apiVersion&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">cilium.io/v2&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">kind&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">CiliumNetworkPolicy&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">metadata&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">inferencia-egress-minimo&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">namespace&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">mision-alfa&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">spec&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">endpointSelector&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">matchLabels&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">app&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">serving-inferencia&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">egressDeny&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">toEntities&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="l">world] &lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c"># no egress outside the cluster&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">egress&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">toEndpoints&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">matchLabels&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">app&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">gateway-modelos&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">toEndpoints&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c"># internal DNS, without this it does not resolve&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">matchLabels&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">k8s:io.kubernetes.pod.namespace&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">kube-system&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">k8s-app&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">kube-dns&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">toPorts&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">ports&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="p">[&lt;/span>{&lt;span class="w"> &lt;/span>&lt;span class="nt">port&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;53&amp;#34;&lt;/span>&lt;span class="nt">, protocol&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">UDP }]&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Two nuances separate a correct policy from a leaky one: you have to explicitly allow DNS and filter by &lt;strong>endpoint identity&lt;/strong>, not by CIDR, because in an identity-based network filtering by IP ranges does not behave the way intuition suggests. On top of this we add flow observability with Hubble and runtime security with &lt;strong>Tetragon&lt;/strong> (eBPF), which watches process execution, file access and connections inside the container, making it possible to detect and block anomalous behaviour; an unexpected process in a sensitive workload is exactly the signal you want to see in real time. Encryption in transit is covered by cert-manager (TLS at the edges) and Cilium&amp;rsquo;s transparent node-to-node encryption. Added to this are the &lt;strong>Pod Security Standards&lt;/strong> in restricted profile (no privileges, no root) and disciplined management of secrets and keys, which do not live in plain manifests.&lt;/p>
&lt;h2 id="requirement-verifiable-software-supply-chain-iron-bankstig-sbom-cmmc">Requirement: verifiable software supply chain (Iron Bank/STIG, SBOM, CMMC)&lt;/h2>
&lt;p>The software supply chain is a first-order attack vector, and the sector treats it as such: images hardened in line with the STIGs, a component inventory (SBOM) and cryptographic verification of provenance. CMMC and NIST 800-171 require it in the supplier flow; Executive Order 14028 popularised the SBOM.&lt;/p>
&lt;p>How we meet it: we start from &lt;strong>hardened base images&lt;/strong> (in the spirit of Iron Bank and the DISA STIGs), we generate an SBOM (CycloneDX/SPDX) per artefact and we &lt;strong>sign images and SBOMs with Sigstore/Cosign&lt;/strong>, a graduated CNCF project, with keyless signing and a transparency log. In the cluster, an &lt;strong>admission control&lt;/strong> (Kyverno/policies) &lt;strong>rejects any image that is not signed&lt;/strong> by a trusted identity, so software whose provenance cannot be verified never runs. The rule is expressed as code and verifies the signature of every image before allowing it to run:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-yaml" data-lang="yaml">&lt;span class="line">&lt;span class="cl">&lt;span class="nt">apiVersion&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">kyverno.io/v1&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">kind&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">ClusterPolicy&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">metadata&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">exigir-imagenes-firmadas&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">spec&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">validationFailureAction&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">Enforce&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">rules&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">verificar-firma-cosign&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">match&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">any&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">resources&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">kinds&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="l">Pod]&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">verifyImages&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">imageReferences&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="s2">&amp;#34;registro.interno/*&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">attestors&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">entries&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">keys&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">publicKeys&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="p">|-&lt;/span>&lt;span class="sd">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="sd"> -----BEGIN PUBLIC KEY-----
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="sd"> ...trusted key...
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="sd"> -----END PUBLIC KEY-----&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>An image without a valid signature is rejected at admission, before it runs. Since the whole deployment is GitOps, the chain, from the commit to the signed image to the policy that admits it, is traceable end to end. This satisfies the supply chain control of NIST 800-171 and fits the cATO model: verification is continuous, not a one-off stamp.&lt;/p>
&lt;h2 id="requirement-sovereignty-and-disconnected-or-air-gapped-operation-classified-networks-ddil">Requirement: sovereignty and disconnected or air-gapped operation (classified networks, DDIL)&lt;/h2>
&lt;p>Defence networks frequently operate isolated from the internet (air-gapped) or under DDIL conditions, degraded, intermittent or low-bandwidth connectivity at the tactical edge. And the data cannot leave to an external API under any circumstances. The requirement: the platform has to work without internet and without taking the data outside.&lt;/p>
&lt;p>How we meet it: inference is served locally, on our own GPUs, with a high-performance serving engine (vLLM) and &lt;strong>open-weight models&lt;/strong> that can be hosted entirely inside the perimeter. Everything the platform needs, container images, models, dependencies, is mirrored into internal registries and repositories, so that the GitOps deployment reconciles from internal sources and requires no internet access. A &lt;strong>model gateway&lt;/strong> centralises access and reverses the burden: the default behaviour is local inference, and any egress is an exception that, besides having to be enabled explicitly, would collide with the default-deny network policies. Sovereignty does not rest on a promise, but on several mutually reinforcing controls, gateway, network policy and isolation, so that a configuration slip does not translate into a leak.&lt;/p>
&lt;p>One point that cannot be overlooked in defence: no component should &amp;ldquo;phone home&amp;rdquo;. Many tools send telemetry, check licences or download updates against external servers by default, and in a classified network that is unacceptable. That is why default-deny is not only a measure against the adversary, but also against the software itself: if an image attempts an undeclared telemetry connection, the policy blocks it and Tetragon logs it. The absence of phone-home is verified, not trusted.&lt;/p>
&lt;h2 id="requirement-resilience-and-operation-at-the-tactical-edge-ddil">Requirement: resilience and operation at the tactical edge (DDIL)&lt;/h2>
&lt;p>Much defence operation happens under DDIL conditions, degraded, intermittent or low-bandwidth connectivity, and even in total isolation. The requirement: the platform must remain useful when the link to the rear falls, and reconcile when it returns.&lt;/p>
&lt;p>How we meet it: the declarative GitOps model fits disconnected operation naturally. An edge site keeps its own copy of the desired state and reconciles against local registries and repositories, so it operates without depending on a permanent connection; when the link returns, it synchronises. Inference is served locally with models already hosted on the node, with no external calls. Traces and audit events are stored locally and forwarded (store-and-forward) when there is a link, without losing the record. The high-availability control plane and the separation into sites allow controlled degradation instead of collapsing as a block. Resilience is not an add-on: it is a property of the declarative design and of sovereign inference.&lt;/p>
&lt;h2 id="requirement-robustness-and-protection-of-the-ai-system-itself-pru-reliability">Requirement: robustness and protection of the AI system itself (PRU reliability)&lt;/h2>
&lt;p>NATO&amp;rsquo;s &lt;strong>reliability&lt;/strong> principle requires AI systems to have explicit and well-tested capabilities, and to be secure against manipulation. This adds a requirement that other sectors treat with less urgency: protecting the model itself, its weights and its behaviour, as a sensitive asset.&lt;/p>
&lt;p>How we meet it: model weights are treated as sensitive data, hosted inside the perimeter and with access controlled by the same identity and network policies as everything else. The model gateway is the point where input and output safeguards are applied (validation, limits, filtering) and where a model can be constrained or disconnected. The signed supply chain (SBOM and Cosign) extends to model artefacts, so that only what has verifiable provenance is executed. And traceability feeds continuous evaluation: measuring the model&amp;rsquo;s behaviour over time is what makes it possible to detect degradation or manipulation before it affects the operation. Robustness is built with the same controls, identity, network, supply chain, traces, now applied to the model as well. Added to this are safeguards against adversarial inputs, prompt injection, manipulated data, at the gateway, which validates and constrains what goes into and out of the model. In defence, assuming the adversary will try to manipulate the AI is not pessimism: it is the design&amp;rsquo;s starting assumption.&lt;/p>
&lt;h2 id="requirement-reliable-execution-of-mission-workloads-and-efficiency-availability-sustainability">Requirement: reliable execution of mission workloads and efficiency (availability, sustainability)&lt;/h2>
&lt;p>Serving AI in-house is only sustainable if the GPU, a scarce and expensive resource, is used well, and certain mission workloads must run reliably and to completion. The default Kubernetes scheduler schedules pod by pod, which for distributed workloads produces half-started jobs that hold GPUs without making progress.&lt;/p>
&lt;p>How we meet it: GPU allocation is governed by &lt;strong>Volcano&lt;/strong> (a CNCF incubating project), today in pre-production, with &lt;strong>gang scheduling&lt;/strong> (&lt;code>PodGroup&lt;/code> with &lt;code>minAvailable&lt;/code>: the job starts complete or does not start), &lt;strong>per-mission queues&lt;/strong> with quota and priority, &lt;strong>fair-share (DRF)&lt;/strong> to share out fairly, &lt;strong>pre-emption&lt;/strong> so that an urgent workload can overtake a deferrable one, and &lt;strong>topology awareness&lt;/strong> (NVLink/PCIe) to reduce fragmentation. This raises the effective utilisation of the GPU fleet, which is what makes sovereign inference viable. On the state of the art: Kubernetes 1.34 took &lt;strong>DRA (Dynamic Resource Allocation)&lt;/strong> to general availability, accelerator allocation by attributes instead of by count, and Kueue covers job quota management; both combine with a gang scheduler. It is managed with metrics: effective versus allocated utilisation, fragmentation, throughput per GPU and GPU-hours per mission. At the edge, where the GPU is even scarcer, these same techniques, together with quantised and smaller models, are what make it possible to serve useful inference with the hardware available instead of depending on a datacenter that may not be reachable.&lt;/p>
&lt;h2 id="requirement-explainability-traceability-and-governability-nato-pru-nist-au">Requirement: explainability, traceability and governability (NATO PRU, NIST AU)&lt;/h2>
&lt;p>Three of NATO&amp;rsquo;s six Principles of Responsible Use bear directly on infrastructure: &lt;strong>explainability and traceability&lt;/strong>, &lt;strong>governability&lt;/strong> and &lt;strong>responsibility/accountability&lt;/strong>. Plus the audit (AU) controls of NIST. The requirement: being able to reconstruct every AI decision, keep human control and be accountable.&lt;/p>
&lt;p>How we meet it: every inference is recorded as an &lt;strong>auditable trace&lt;/strong> with Langfuse, input, output, model and version, cost, latency and mission, stored in our own components locked behind network policies that prevent it from leaving. That trace provides the traceability required by the PRU and by the NIST AU controls, and is the basis for human oversight, which is exercised at the &lt;strong>gateway&lt;/strong> (review, limits and, crucially, the possibility of intervention and disconnection demanded by the &lt;strong>governability&lt;/strong> principle: an AI system in defence must be able to be deactivated or constrained by the operator). An audit log is only worth anything as evidence if it is intact and ordered in time: that is why events are kept in append-only storage and clocks are kept synchronised by NTP. Instrumentation converges on the OpenTelemetry GenAI semantic conventions.&lt;/p>
&lt;p>Accountability also requires being able to attribute a decision: which model, which version, which input and which operator were involved. That is why each trace links the inference to the identity that requested it and to the exact version of the model artefact that answered, so that the chain &amp;ldquo;who asked what, with which system and with what result&amp;rdquo; can be reconstructed. Without that attribution, NATO&amp;rsquo;s responsibility and accountability principle remains a statement of intent.&lt;/p>
&lt;h2 id="requirement-continuous-accreditation-and-reproducible-operation-cato-cmmc-ens">Requirement: continuous accreditation and reproducible operation (cATO, CMMC, ENS)&lt;/h2>
&lt;p>The sector has replaced one-off accreditation with &lt;strong>cATO&lt;/strong>: an authorisation that is maintained as long as it is continuously demonstrated that the controls remain in place. The ENS and CMMC likewise require configuration management and traceability of changes.&lt;/p>
&lt;p>How we meet it: the entire platform state, deployments, network policies, quotas, RBAC, identity, admission policies, is described in Git and applied by Flux over GitOps. Every change is a revision with an author, a date and a reviewer; every environment is reproducible from its repository. Security policies are code (Kyverno/OPA) evaluated continuously, not a list someone reviews once a year, and compliance monitoring is permanent. This is what cATO looks like in practice: an audit stops being a snapshot and becomes a query against a state that is maintained and verified without interruption, with the ability to reconstruct exactly what was deployed on a given date. A practical benefit is that compliance evidence generates itself: the declarative state in Git, the admission records, the image signatures and the traces are, together, the body of evidence an accreditation needs, produced continuously instead of gathered by hand the week before the inspection.&lt;/p>
&lt;h2 id="the-piece-that-ties-it-all-together-isoiec-42001-and-natos-principles">The piece that ties it all together: ISO/IEC 42001 and NATO&amp;rsquo;s principles&lt;/h2>
&lt;p>Everything above consists of technical controls that satisfy concrete requirements. But a management system is needed to order, evaluate and improve them, with defined roles and responsibilities. In defence, that governance has two complementary references: NATO&amp;rsquo;s &lt;strong>Principles of Responsible Use&lt;/strong>, which set the ethical and operational &amp;ldquo;what&amp;rdquo;, and &lt;strong>ISO/IEC 42001&lt;/strong>, the certifiable standard for AI management systems, which supplies the &amp;ldquo;how&amp;rdquo; of continuous management. Given that the AI Act excludes defence, this combination, PRU plus ISO 42001, is the governance backbone for responsible, demonstrable military AI. It is, precisely, the content of the AI Management Systems course we will publish shortly.&lt;/p>
&lt;h2 id="a-view-of-the-sector-as-of-june-2026">A view of the sector as of June 2026&lt;/h2>
&lt;p>It is worth pinning down the snapshot of the moment, because several currents have converged and they condition any platform decision.&lt;/p>
&lt;p>&lt;strong>An &amp;ldquo;AI-first&amp;rdquo; agenda and AI on classified networks.&lt;/strong> In January 2026, the US Department of Defense set an AI agenda at &amp;ldquo;war speed&amp;rdquo;, and through the spring agreements were closed to deploy generative AI models &lt;strong>on classified networks&lt;/strong>. The signal is clear: military AI is moving from pilot to operation, which raises the demands on the infrastructure that supports it.&lt;/p>
&lt;p>&lt;strong>The substrate is hardened Kubernetes.&lt;/strong> Platform One, Big Bang and Iron Bank consolidate the pattern: Kubernetes clusters with STIG-compliant images, a signed supply chain and cATO. Defence AI is deployed on that same cloud-native substrate, not on bespoke systems.&lt;/p>
&lt;p>&lt;strong>Zero Trust with a deadline.&lt;/strong> Zero Trust adoption targets sit around 2027, which turns strong identity, microsegmentation and continuous verification into requirements with a calendar, not aspirations.&lt;/p>
&lt;p>&lt;strong>Supplier accreditation is tightening.&lt;/strong> CMMC Phase 2, in November 2026, ends self-attestation for anyone handling controlled information: third-party certification against the 110 NIST 800-171 controls will be required. The software supply chain, SBOM and Sigstore signing, moves from good practice to a contractual condition.&lt;/p>
&lt;p>&lt;strong>Data-centric security, operational at last.&lt;/strong> With STANAG 4774/4778 advancing through ratification, confidentiality labelling bound to the data becomes a real requirement for mission software, and not just a recommendation.&lt;/p>
&lt;p>&lt;strong>Defence-specific AI governance.&lt;/strong> NATO&amp;rsquo;s Principles of Responsible Use and the DARB are maturing as the reference framework, occupying the space the AI Act leaves free by excluding defence. And GPU economics, together with the maturity of open-weight models, pushes compute towards in-house infrastructure, precisely where classified data and disconnected operation demand it.&lt;/p>
&lt;p>&lt;strong>Europe pushes its own autonomy.&lt;/strong> In parallel, the EU is strengthening its defence industrial and technological base, through the European Defence Fund and the European Defence Agency, with growing emphasis on technological sovereignty. For a European platform, this reinforces the bet on in-house infrastructure, locally hostable models and minimal dependence on external services: exactly the direction it is built in.&lt;/p>
&lt;p>Where we stand in that picture: with the platform on Kubernetes, eBPF as the network and security substrate, a signed supply chain, GPU scheduling maturing in pre-production, sovereign and disconnectable inference by design, traceability in auditable format and the management framework (PRU plus ISO 42001) as the next step. We are not chasing fashion; we are on the line the sector has decided to advance along.&lt;/p>
&lt;h2 id="summary-requirement-by-requirement">Summary: requirement by requirement&lt;/h2>
&lt;p>Each rule or standard in the sector imposes a requirement, and each requirement is satisfied by a concrete piece of the infrastructure. Zero Trust and verified access, with Keycloak, mTLS and default-deny. The data-centric security of STANAG 4774/4778, with ABAC over classification labels. Segregation by mission and level, with multitenancy and, where appropriate, physical separation and cross-domain. Confidentiality and leak prevention, with Cilium in default-deny and Tetragon. A verifiable supply chain, with STIG-hardened images, SBOM and Sigstore signing plus admission control. Sovereignty and disconnected operation, with local inference over open models and internal registries. Reliable execution and efficiency, with Volcano. The explainability, traceability and governability of NATO&amp;rsquo;s PRU, with auditable traces and human control at the gateway. Continuous accreditation (cATO) and reproducible operation, with GitOps and policy as code. And the governance that ties it all together, with NATO&amp;rsquo;s PRU and ISO 42001.&lt;/p>
&lt;p>It is not a PowerPoint: it is infrastructure that operates, that complies and that, being infrastructure, is measured by efficiency and cost. That, the cost control of an AI platform, is what the next article is about.&lt;/p>
&lt;h2 id="sources">Sources&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="https://standards.globalspec.com/std/10266868/stanag-4774">NATO STANAG 4774 — Confidentiality Metadata Label Syntax&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://www.archtis.com/achieving-nato-stanag-4774-and-4778-compliance/">NATO STANAG 4778 — Metadata Binding Mechanism&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://www.nato.int/cps/en/natohq/news_227234.htm">NATO — Principios de Uso Responsable de la IA y Estrategia revisada (2024)&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://dodcio.defense.gov/Portals/0/Documents/Library/DoD%20Enterprise%20DevSecOps%20Reference%20Design%20-%20CNCF%20Kubernetes%20w-DD1910_cleared_20211022.pdf">DoD Enterprise DevSecOps Reference Design — CNCF Kubernetes&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/DoD-Platform-One/bigbang">DoD — Big Bang / Platform One&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://dodcio.defense.gov/Portals/0/Documents/Library/(U)ZT_RA_v2.0(U)_Sep22.pdf">DoD Zero Trust Reference Architecture v2.0&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://dodcio.defense.gov/Portals/0/Documents/CMMC/CMMC-AlignmentNIST-Standards.pdf">CMMC 2.0 y NIST SP 800-171 (cadena de suministro de defensa)&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://docs.sigstore.dev/">Sigstore / Cosign — firma de imágenes y SBOM (CNCF)&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://volcano.sh/en/docs/">Volcano — scheduling batch (CNCF)&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://cilium.io/">Cilium y Tetragon (eBPF)&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://www.iso.org/standard/81230.html">ISO/IEC 42001 — Sistemas de gestión de IA&lt;/a>&lt;/li>
&lt;/ul></description></item><item><title>Measuring energy in production: Kepler, DCGM and the practical stack (accuracy and overhead)</title><link>https://blog.lo0.es/en/posts/measuring-energy-in-production-kepler-dcgm-stack/</link><pubDate>Sun, 14 Jun 2026 05:00:00 +0200</pubDate><guid>https://blog.lo0.es/en/posts/measuring-energy-in-production-kepler-dcgm-stack/</guid><description>&lt;blockquote>
&lt;p>Notation: amounts in &lt;strong>euros (N €)&lt;/strong>, decimals with a point. The dollar sign is not used
(on this site it is a formula delimiter).&lt;/p>
&lt;/blockquote>
&lt;h2 id="what-this-article-covers">What this article covers&lt;/h2>
&lt;p>Third article of the energy track (C3). C1 made the conceptual inventory of the tools;
here we get practical: how the measurement stack is deployed on Kubernetes, where each
piece takes its figures from, how accurate it is against a power meter, how much
overhead it adds, and how energy is attributed per pod and per MIG instance. It is the
equivalent of B2/B3 for energy: to stop talking about what each tool measures and start
building the bench that measures it. With commands; no recommendations, only the mechanics.&lt;/p>
&lt;hr>
&lt;h2 id="the-measurement-stack-on-kubernetes">The measurement stack on Kubernetes&lt;/h2>
&lt;p>To measure energy per workload on a GPU cluster, the practical stack has four pieces, and the
good news is that three of them you already have if you do observability:&lt;/p>
&lt;div class="diagram" style="max-width:780px;margin:1rem auto;">
&lt;svg viewBox="0 0 780 230" role="img" aria-label="Energy measurement stack on Kubernetes: DCGM exporter and Kepler export to Prometheus, which Grafana visualises, with the power meter as calibration" xmlns="http://www.w3.org/2000/svg">
&lt;style>.bx{fill:none;stroke:currentColor;stroke-width:1.3}.dsh{fill:none;stroke:currentColor;stroke-width:1.3;stroke-dasharray:5 3}.tl{font:600 12px sans-serif;fill:currentColor}.ts{font:11px sans-serif;fill:currentColor}.ar{fill:none;stroke:currentColor;stroke-width:1.3;marker-end:url(#em)}&lt;/style>
&lt;defs>&lt;marker id="em" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto">&lt;path d="M0,0 L10,5 L0,10 z" fill="currentColor"/>&lt;/marker>&lt;/defs>
&lt;rect class="bx" x="20" y="40" width="170" height="44" rx="6"/>&lt;text x="32" y="60" class="tl">DCGM exporter&lt;/text>&lt;text x="32" y="76" class="ts">GPU power&lt;/text>
&lt;rect class="bx" x="20" y="100" width="170" height="44" rx="6"/>&lt;text x="32" y="120" class="tl">Kepler (eBPF)&lt;/text>&lt;text x="32" y="136" class="ts">energy per pod/node&lt;/text>
&lt;path class="ar" d="M190,62 L250,90"/>
&lt;path class="ar" d="M190,122 L250,108"/>
&lt;rect class="bx" x="250" y="78" width="160" height="44" rx="6"/>&lt;text x="262" y="98" class="tl">Prometheus&lt;/text>&lt;text x="262" y="114" class="ts">time series&lt;/text>
&lt;path class="ar" d="M410,100 L470,100"/>
&lt;rect class="bx" x="470" y="78" width="160" height="44" rx="6"/>&lt;text x="482" y="98" class="tl">Grafana&lt;/text>&lt;text x="482" y="114" class="ts">panels · alerts&lt;/text>
&lt;rect class="dsh" x="650" y="78" width="110" height="44" rx="6"/>&lt;text x="662" y="98" class="tl">Power meter&lt;/text>&lt;text x="662" y="114" class="ts">calibration&lt;/text>
&lt;text x="20" y="180" class="ts">DCGM, Prometheus and Grafana are already there if you do GPU observability; Kepler adds per-pod attribution.&lt;/text>
&lt;text x="20" y="202" class="ts">The physical meter (point in time) calibrates the estimates: not part of the continuous stack, but the ground truth.&lt;/text>
&lt;/svg>
&lt;/div>
&lt;p>The new piece compared with a normal observability stack is Kepler, which adds &lt;strong>energy
attribution per pod&lt;/strong>. DCGM already gives GPU power; Prometheus stores it; Grafana draws it. It
is reused infrastructure, not a new system, in line with &lt;a href="https://blog.lo0.es/en/posts/gpu-observability-llm-inference-twelve-dcgm-vllm-metrics/">GPU observability via DCGM&lt;/a>.&lt;/p>
&lt;hr>
&lt;h2 id="dcgm-exporter-the-base-of-gpu-power">DCGM exporter: the base of GPU power&lt;/h2>
&lt;p>GPU power, the dominant source in LLM inference, comes from NVIDIA&amp;rsquo;s dcgm-exporter
(part of the GPU Operator), which exposes DCGM metrics to Prometheus. The key metric is
&lt;code>DCGM_FI_DEV_POWER_USAGE&lt;/code> (instantaneous power in W), alongside utilisation
(&lt;code>DCGM_FI_DEV_GPU_UTIL&lt;/code>) and memory. With that, energy is the integral of power over time
across the workload&amp;rsquo;s window. DCGM gives power at card level; to split it per pod or per
MIG instance you need a layer on top, which is Kepler.&lt;/p>
&lt;hr>
&lt;h2 id="kepler-in-depth-ebpf-and-the-sources">Kepler in depth: eBPF and the sources&lt;/h2>
&lt;p>Kepler (Kubernetes-based Efficient Power Level Exporter) is a Prometheus exporter that
measures energy at container, pod and node level, using eBPF to keep overhead low and
scientific methods to improve accuracy (&lt;a href="https://github.com/sustainable-computing-io/kepler">Kepler · GitHub&lt;/a>).
Its strength is that it combines several power sources:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Source&lt;/th>
&lt;th>What it covers&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;strong>RAPL&lt;/strong>&lt;/td>
&lt;td>CPU and DRAM&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>NVML&lt;/strong>&lt;/td>
&lt;td>NVIDIA GPU power&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>ACPI&lt;/strong>&lt;/td>
&lt;td>platform power management&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Redfish / IPMI&lt;/strong>&lt;/td>
&lt;td>platform power (BMC)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Regression models&lt;/strong>&lt;/td>
&lt;td>estimation when there is no real metric&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>For the GPU, the &lt;code>dcgmEndpoint&lt;/code> parameter points at the dcgm-exporter metrics URL, which
enables power attribution per MIG instance (&lt;a href="https://github.com/sustainable-computing-io/kepler/blob/main/docs/user/configuration.md">Kepler · configuration&lt;/a>).
That is: DCGM gives the card&amp;rsquo;s power, Kepler splits it between the pods (and MIG partitions)
that use it, via eBPF and models. The result is per-pod energy metrics in Prometheus, ready
for Grafana, usable for scheduling or scaling, consumption reporting and visualisation
(&lt;a href="https://github.com/sustainable-computing-io/kepler">Kepler · GitHub&lt;/a>).&lt;/p>
&lt;div class="diagram" style="max-width:780px;margin:1rem auto;">
&lt;svg viewBox="0 0 780 210" role="img" aria-label="Kepler combines RAPL, NVML/DCGM, ACPI and Redfish, and with eBPF splits the energy per pod and per MIG instance" xmlns="http://www.w3.org/2000/svg">
&lt;style>.bx{fill:none;stroke:currentColor;stroke-width:1.3}.tl{font:600 12px sans-serif;fill:currentColor}.ts{font:11px sans-serif;fill:currentColor}.ar{fill:none;stroke:currentColor;stroke-width:1.3;marker-end:url(#km)}&lt;/style>
&lt;defs>&lt;marker id="km" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto">&lt;path d="M0,0 L10,5 L0,10 z" fill="currentColor"/>&lt;/marker>&lt;/defs>
&lt;rect class="bx" x="20" y="36" width="150" height="30" rx="5"/>&lt;text x="30" y="56" class="ts">RAPL (CPU/DRAM)&lt;/text>
&lt;rect class="bx" x="20" y="76" width="150" height="30" rx="5"/>&lt;text x="30" y="96" class="ts">NVML/DCGM (GPU)&lt;/text>
&lt;rect class="bx" x="20" y="116" width="150" height="30" rx="5"/>&lt;text x="30" y="136" class="ts">ACPI · Redfish/IPMI&lt;/text>
&lt;path class="ar" d="M170,51 L230,80"/>
&lt;path class="ar" d="M170,91 L230,91"/>
&lt;path class="ar" d="M170,131 L230,102"/>
&lt;rect class="bx" x="230" y="70" width="170" height="44" rx="6"/>&lt;text x="242" y="90" class="tl">Kepler (eBPF + model)&lt;/text>&lt;text x="242" y="106" class="ts">splits the power&lt;/text>
&lt;path class="ar" d="M400,92 L460,92"/>
&lt;rect class="bx" x="460" y="70" width="180" height="44" rx="6"/>&lt;text x="472" y="90" class="tl">Energy per pod / MIG&lt;/text>&lt;text x="472" y="106" class="ts">→ Prometheus&lt;/text>
&lt;text x="20" y="180" class="ts">DCGM gives the card's power; Kepler attributes it to each pod and MIG partition, as OpenCost attributes cost.&lt;/text>
&lt;/svg>
&lt;/div>
&lt;hr>
&lt;h2 id="deployment-a-daemonset-on-top-of-prometheus">Deployment: a DaemonSet on top of Prometheus&lt;/h2>
&lt;p>The deployment is a DaemonSet (one Kepler per node), pointing at the existing Prometheus
and at the dcgm-exporter:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Helm, pointing at the dcgm-exporter for GPU attribution&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">helm install kepler kepler/kepler &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --namespace kepler --create-namespace &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --set &lt;span class="nv">dcgmEndpoint&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="s2">&amp;#34;http://dcgm-exporter:9400/metrics&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Prerequisites: a kernel with eBPF, the dcgm-exporter running (from the GPU Operator) and
Prometheus scraping. Once deployed, Kepler exposes metrics such as
&lt;code>kepler_container_joules_total&lt;/code> per pod, queried with PromQL and drawn in Grafana. Energy per
workload stops being a manual estimate and becomes a continuous time series, just like cost
with OpenCost.&lt;/p>
&lt;hr>
&lt;h2 id="promql-queries-energy-per-pod">PromQL queries: energy per pod&lt;/h2>
&lt;p>With Kepler exporting, these are the queries that build the panels. The exact names vary by
version; check your &lt;code>/metrics&lt;/code>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-promql" data-lang="promql">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Cumulative energy per pod (joules)&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nv">kepler_container_joules_total&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="c1"># Mean power per namespace over the last hour (W)&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="k">sum&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="k">by&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="o">(&lt;/span>&lt;span class="nv">namespace&lt;/span>&lt;span class="o">)&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="o">(&lt;/span>&lt;span class="kr">rate&lt;/span>&lt;span class="o">(&lt;/span>&lt;span class="nv">kepler_container_joules_total&lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="s">1h&lt;/span>&lt;span class="p">]&lt;/span>&lt;span class="o">))&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="c1"># GPU power per node (from DCGM, W)&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="k">sum&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="k">by&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="o">(&lt;/span>&lt;span class="nv">node&lt;/span>&lt;span class="o">)&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="o">(&lt;/span>&lt;span class="nv">DCGM_FI_DEV_POWER_USAGE&lt;/span>&lt;span class="o">)&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="c1"># Energy per token: power ÷ throughput (with a gateway/engine metric)&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="k">sum&lt;/span>&lt;span class="o">(&lt;/span>&lt;span class="kr">rate&lt;/span>&lt;span class="o">(&lt;/span>&lt;span class="nv">kepler_container_joules_total&lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="s">5m&lt;/span>&lt;span class="p">]&lt;/span>&lt;span class="o">))&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="o">/&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="k">sum&lt;/span>&lt;span class="o">(&lt;/span>&lt;span class="kr">rate&lt;/span>&lt;span class="o">(&lt;/span>&lt;span class="nv">vllm_generation_tokens_total&lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="s">5m&lt;/span>&lt;span class="p">]&lt;/span>&lt;span class="o">))&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The last one closes the circle with the cost track: it crosses Kepler&amp;rsquo;s energy with the
engine/gateway tokens to give J/token in real time, per workload. With that in Grafana you
have energy per pod, per namespace and per token, continuously, the energy equivalent of the
OpenCost cost report.&lt;/p>
&lt;hr>
&lt;h2 id="a-calibration-procedure">A calibration procedure&lt;/h2>
&lt;p>Since Kepler estimates, it is worth calibrating once per node type. A simple procedure:&lt;/p>
&lt;ol>
&lt;li>&lt;strong>Power meter at the node input&lt;/strong> (or a PDU/BMC reading), measuring the node&amp;rsquo;s real power.&lt;/li>
&lt;li>&lt;strong>Controlled load&lt;/strong>: a stable sweep at a known power (the engine at 80 % GPU, say).&lt;/li>
&lt;li>&lt;strong>Compare&lt;/strong>: the node&amp;rsquo;s sum of &lt;code>kepler_container_joules_total&lt;/code> plus idle against the meter
reading over the same window.&lt;/li>
&lt;li>&lt;strong>Adjust&lt;/strong> Kepler&amp;rsquo;s factor or model if the deviation is noticeable, and document the
residual error.&lt;/li>
&lt;li>&lt;strong>Repeat&lt;/strong> for each node type (calibration is not transferable between different hardware).&lt;/li>
&lt;/ol>
&lt;p>With that residual error documented, Kepler&amp;rsquo;s continuous figure has a known error bar,
which is exactly what a CSRD auditor or a technical committee will ask for. Measuring without
calibrating gives a number with no credibility; calibrating once turns the continuous estimate
into a defensible figure.&lt;/p>
&lt;hr>
&lt;h2 id="accuracy-estimation-vs-power-meter">Accuracy: estimation vs power meter&lt;/h2>
&lt;p>The data honesty of the energy track: Kepler estimates (eBPF + models + counters), it does
not measure with a power meter. Accuracy depends on the source: with NVML/DCGM and RAPL
available, the figure is fairly faithful (it reads hardware counters); when it falls back on
regression models (with no real metric), it is an estimate with more error. Good practice:
calibrate against a physical power meter at least once per node type, adjust, and use
Kepler as a continuous proxy. The meter is the point-in-time ground truth; Kepler, the
continuous series calibrated against it. For a CSRD report that an auditor may challenge, that
initial calibration is what gives the continuous figure credibility.&lt;/p>
&lt;hr>
&lt;h2 id="overhead-the-cost-of-measuring">Overhead: the cost of measuring&lt;/h2>
&lt;p>Measuring energy has its own compute cost, worth budgeting for. In a Kubernetes environment,
the overhead of the monitoring system is split between the Prometheus server and the targets:
the Prometheus server consumes ~150 % of CPU (1.5 cores) and ~15 GB of RAM, while the
targets (node exporter and dcgm-exporter) together use ~35 % of CPU and ~300 MB of RAM
(&lt;a href="https://arxiv.org/pdf/2504.10702">arXiv · Container-level Energy Observability&lt;/a>). Kepler uses
eBPF precisely to keep its own overhead low. The reading: the bulk of the cost of measuring is
in Prometheus (which you probably already have for observability), not in the energy
exporters. Adding Kepler to an existing observability stack is marginal; standing up
Prometheus just for this would be expensive. That is why measuring energy is nearly free if
you already observe, and a project if you do not.&lt;/p>
&lt;hr>
&lt;h2 id="zeus-for-the-bench-and-for-optimisation-not-for-continuous-production">Zeus: for the bench and for optimisation, not for continuous production&lt;/h2>
&lt;p>Zeus (ml.energy) plays a different role: it is not a continuous production exporter, it is
the bench tool for measuring and optimising the energy of one specific workload (a
benchmark, a training run), with power capping and frequency selection. It fits into the
benchmarking flow (alongside GuideLLM/AIPerf): during a sweep, Zeus measures the energy per
configuration and lets you test the effect of power capping on performance. The practical
division: Kepler/DCGM in production (continuous per-pod attribution), Zeus on the bench
(fine measurement + optimisation of one workload), CodeCarbon if you want carbon context
integrated into an ML pipeline.&lt;/p>
&lt;hr>
&lt;h2 id="codecarbon-and-scaphandre-in-practice">CodeCarbon and Scaphandre in practice&lt;/h2>
&lt;p>The other two pieces, with their specific role:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>CodeCarbon&lt;/strong> integrates inside the code of an ML pipeline (a decorator or a context
manager wrapping the training or the inference), and returns the energy and the CO₂eq of
that block, using &lt;code>nvidia-smi&lt;/code> for the GPU and estimating CPU/RAM. It fits when you want the
carbon figure per experiment or per ML job, integrated into the data flow, not at
infrastructure level. It is the closest to the power meter among the Python tools.&lt;/li>
&lt;li>&lt;strong>Scaphandre&lt;/strong> is a metrology agent in Rust that reads RAPL and gives process/VM power
with raw hardware accuracy. For CPU it is very accurate; for GPU it has to be combined with
NVML. It fits when you need the most faithful CPU metrology, or a lightweight agent
independent of Kubernetes.&lt;/li>
&lt;/ul>
&lt;p>The division with Kepler: Kepler attributes energy per pod in the cluster (the
infrastructure view); CodeCarbon gives carbon per ML job (the pipeline view);
Scaphandre gives raw CPU metrology. They do not compete; they cover different layers, and
a mature platform uses whichever matches the question.&lt;/p>
&lt;hr>
&lt;h2 id="choosing-the-stack-by-objective">Choosing the stack by objective&lt;/h2>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Objective&lt;/th>
&lt;th>Tool&lt;/th>
&lt;th>Why&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>Continuous per-pod attribution (production)&lt;/td>
&lt;td>&lt;strong>Kepler + DCGM&lt;/strong>&lt;/td>
&lt;td>eBPF, per pod/MIG, into Prometheus&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Fine measurement + optimisation (bench)&lt;/td>
&lt;td>&lt;strong>Zeus&lt;/strong>&lt;/td>
&lt;td>measures and optimises (power capping)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Carbon in an ML pipeline&lt;/td>
&lt;td>&lt;strong>CodeCarbon&lt;/strong>&lt;/td>
&lt;td>integrated CO₂eq, close to the power meter&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Raw CPU accuracy (RAPL)&lt;/td>
&lt;td>&lt;strong>Scaphandre&lt;/strong>&lt;/td>
&lt;td>hardware metrology&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Calibration / ground truth&lt;/td>
&lt;td>&lt;strong>power meter&lt;/strong>&lt;/td>
&lt;td>the standard everything is calibrated against&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>It is not &amp;ldquo;one tool&amp;rdquo;, it is a stack by objective: continuous production (Kepler/DCGM),
bench (Zeus), reporting (CodeCarbon), calibration (power meter). Mixing them according to the
phase is what gives a complete and credible energy measurement.&lt;/p>
&lt;hr>
&lt;h2 id="from-figure-to-action">From figure to action&lt;/h2>
&lt;p>Measuring is the start; the value is in acting. With energy per pod in Prometheus:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Reporting (CSRD)&lt;/strong>: the carbon footprint per workload, calibrated, ready for regulatory
reporting.&lt;/li>
&lt;li>&lt;strong>Energy/carbon-aware scheduling&lt;/strong>: move deferrable load to hours or nodes of lower
intensity (connects with the hourly carbon of the Spanish grid).&lt;/li>
&lt;li>&lt;strong>Power capping&lt;/strong>: with Zeus, trim peak power with little performance loss, lowering the W in
the numerator of J/token.&lt;/li>
&lt;li>&lt;strong>Optimisation&lt;/strong>: identify pods with poor energy efficiency (a lot of energy per token) and
attack them with quantisation or batching.&lt;/li>
&lt;/ul>
&lt;p>The measurement stack is not a panel to look at: it is the input to scheduling, optimisation
and reporting decisions. Just as OpenCost closes the cost loop, Kepler+DCGM closes the energy
one.&lt;/p>
&lt;hr>
&lt;h2 id="from-energy-to-carbon-the-final-layer">From energy to carbon: the final layer&lt;/h2>
&lt;p>The energy figure (kWh) becomes carbon by multiplying by the grid intensity, and here the
practical stack connects with the hourly source. In Spain, the intensity is published by &lt;strong>Red
Eléctrica (esios) and aggregated by ElectricityMaps&lt;/strong>, hour by hour. The pattern:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-promql" data-lang="promql">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Carbon per workload: energy (kWh) × grid intensity (gCO2/kWh)&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="o">(&lt;/span>&lt;span class="k">sum&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="k">by&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="o">(&lt;/span>&lt;span class="nv">namespace&lt;/span>&lt;span class="o">)&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="o">(&lt;/span>&lt;span class="kr">increase&lt;/span>&lt;span class="o">(&lt;/span>&lt;span class="nv">kepler_container_joules_total&lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="s">1h&lt;/span>&lt;span class="p">]&lt;/span>&lt;span class="o">))&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="o">/&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="mf">3.6&lt;/span>&lt;span class="nv">e6&lt;/span>&lt;span class="o">)&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="o">*&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="k">on&lt;/span>&lt;span class="o">()&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="k">group_left&lt;/span>&lt;span class="o">()&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="nv">grid_carbon_intensity_gco2_kwh&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>where &lt;code>grid_carbon_intensity_gco2_kwh&lt;/code> is a metric you feed from esios/ElectricityMaps (an
exporter or a periodic push). With that, the Grafana panel shows &lt;strong>gCO₂ per namespace and per
token, hour by hour&lt;/strong>, not an annual average. And since Spanish intensity varies a lot (from
~80 in solar hours to ~250 on gas-heavy nights), that hourly resolution is what enables
carbon-aware scheduling: moving the deferrable work to the clean hours lowers the measured
carbon. The measurement stack does not only report carbon; with the hourly figure, it &lt;strong>allows
it to be reduced&lt;/strong>.&lt;/p>
&lt;hr>
&lt;h2 id="energy-efficiency-kpis-to-watch">Energy efficiency KPIs to watch&lt;/h2>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>KPI&lt;/th>
&lt;th>What it indicates&lt;/th>
&lt;th>Where from&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;strong>J/token per model&lt;/strong>&lt;/td>
&lt;td>energy efficiency&lt;/td>
&lt;td>Kepler ÷ engine tokens&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Mean power per pod&lt;/strong>&lt;/td>
&lt;td>consumption per workload&lt;/td>
&lt;td>&lt;code>rate(kepler_container_joules_total)&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>gCO₂/token (hourly)&lt;/strong>&lt;/td>
&lt;td>real footprint&lt;/td>
&lt;td>energy × grid intensity&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Idle energy&lt;/strong>&lt;/td>
&lt;td>waste&lt;/td>
&lt;td>power of pods with no traffic&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Effective PUE&lt;/strong>&lt;/td>
&lt;td>DC overhead&lt;/td>
&lt;td>total energy ÷ compute energy&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>These five turn the energy panel into a decision tool: which model is more efficient, which pod
wastes, when it pays to schedule. Without them the stack is a pretty panel; with them, it is
the input to optimisation and reporting.&lt;/p>
&lt;hr>
&lt;h2 id="example-energy-attribution-on-a-multi-tenant-cluster">Example: energy attribution on a multi-tenant cluster&lt;/h2>
&lt;p>With Kepler splitting per pod, an energy report per team on the example node (8×H100,
5.6 kW of boards, ~7.84 kW with PUE), over one month:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Team&lt;/th>
&lt;th>Energy/month (kWh)&lt;/th>
&lt;th>gCO₂ (ES grid ~160)&lt;/th>
&lt;th>Mean J/token&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>A · chat-prod&lt;/td>
&lt;td>~3,100&lt;/td>
&lt;td>~496 kg&lt;/td>
&lt;td>~2.2 J/tok&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>B · batch&lt;/td>
&lt;td>~1,400&lt;/td>
&lt;td>~224 kg&lt;/td>
&lt;td>~2.8 J/tok&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>C · experimentation&lt;/td>
&lt;td>~900&lt;/td>
&lt;td>~144 kg&lt;/td>
&lt;td>~6.5 J/tok&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>idle&lt;/td>
&lt;td>~250&lt;/td>
&lt;td>~40 kg&lt;/td>
&lt;td>—&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>What it reveals: A is efficient (FP8, high utilisation → 2.2 J/token); C is inefficient
(6.5 J/token, underused GPU), just as it dragged the idle cost in the FinOps track. The carbon
column takes the figure into the per-team CSRD report. And the idle row (~250 kWh, ~40 kg
CO₂) is pure wasted energy. Without Kepler, that split does not exist: you would only see the
node&amp;rsquo;s total consumption, with no idea whose each watt is. With it, energy is attributable and
actionable, exactly like cost with OpenCost. In fact, the two panels together (OpenCost cost +
Kepler energy) give the complete picture of efficiency per team.&lt;/p>
&lt;hr>
&lt;h2 id="energy-and-carbon-aware-scheduling">Energy and carbon-aware scheduling&lt;/h2>
&lt;p>The highest-return action the stack enables: scheduling by energy and carbon. With energy
per pod and hourly grid intensity in Prometheus, two policies:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>By carbon&lt;/strong>: move the deferrable load (training, ingestion, overnight batch) to the
hours of lowest grid intensity. In Spain, the hours of peak solar (~80 gCO₂/kWh) against
gas-heavy nights (~250). The same workload emits ~3× less when scheduled at the right hour.&lt;/li>
&lt;li>&lt;strong>By efficiency&lt;/strong>: consolidate workloads to eliminate idle (a powered GPU with no work is
wasted energy), and direct each workload to the hardware most efficient for it.&lt;/li>
&lt;/ul>
&lt;p>Both use the same data (energy per pod + hourly intensity) that the stack already exposes, and
they connect with cluster scheduling (Kueue/Volcano). It is the difference between
measuring carbon (and reporting it) and reducing it (by scheduling). The C3 stack
enables both.&lt;/p>
&lt;hr>
&lt;h2 id="deployment-checklist">Deployment checklist&lt;/h2>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Step&lt;/th>
&lt;th>Action&lt;/th>
&lt;th>Verification&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>1&lt;/td>
&lt;td>dcgm-exporter (GPU Operator)&lt;/td>
&lt;td>&lt;code>DCGM_FI_DEV_POWER_USAGE&lt;/code> in Prometheus&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>2&lt;/td>
&lt;td>Kepler DaemonSet, kernel with eBPF&lt;/td>
&lt;td>&lt;code>kepler_container_joules_total&lt;/code> per pod&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>3&lt;/td>
&lt;td>&lt;code>dcgmEndpoint&lt;/code> pointing at the exporter&lt;/td>
&lt;td>GPU/MIG attribution works&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>4&lt;/td>
&lt;td>Grid intensity metric (esios)&lt;/td>
&lt;td>&lt;code>grid_carbon_intensity&lt;/code> in Prometheus&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>5&lt;/td>
&lt;td>Calibration vs power meter (once per node type)&lt;/td>
&lt;td>error bar documented&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>6&lt;/td>
&lt;td>Grafana panels (J/token, carbon, idle)&lt;/td>
&lt;td>KPIs visible&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>Step 5 (calibration) is the one most often skipped and the one that gives the figure
credibility; step 3 (&lt;code>dcgmEndpoint&lt;/code>) is the one most often forgotten, and without it the GPU is
not attributed.&lt;/p>
&lt;hr>
&lt;h2 id="energy-by-phase-prefill-vs-decode">Energy by phase: prefill vs decode&lt;/h2>
&lt;p>A level of detail the stack allows and that guides optimisation: power is not constant
during a request. Prefill (processing the prompt) is compute-bound and draws a lot of power
in a burst; decode (generating tokens) is memory-bound and draws a lower peak but for
longer. With fine DCGM sampling that bimodal profile is visible, and it has consequences:&lt;/p>
&lt;ul>
&lt;li>A workload with long prompts (a lot of prefill) has a different power profile from one with
long generation (a lot of decode), even if they produce the same tokens.&lt;/li>
&lt;li>&lt;strong>Power capping&lt;/strong> affects each phase differently: trimming peak power mostly touches the
prefill.&lt;/li>
&lt;/ul>
&lt;p>For most cases the mean J/token is enough; to optimise energy efficiency thoroughly,
separating prefill and decode consumption (aligning the DCGM window with each phase) reveals
where the spend is. It is the energy equivalent of separating TTFT and TPOT in benchmarking,
the same principle, measuring the two phases separately because they behave differently.&lt;/p>
&lt;hr>
&lt;h2 id="state-of-the-art-the-llm-resolution-gap">State of the art: the LLM resolution gap&lt;/h2>
&lt;p>An honest note on the limits of current tooling. The general-purpose tools (Kepler,
CodeCarbon, Scaphandre) measure well at machine, process and pod level, but they &lt;strong>lack
LLM-specific resolution&lt;/strong>: out of the box they do not distinguish prefill from decode energy,
nor energy per token by phase, nor the energy cost of a reasoning block against a normal
response. It is an open gap in the field: per-pod attribution exists, but attribution &lt;strong>per
token and per inference phase&lt;/strong> has to be built by crossing power (DCGM/Kepler) with engine
metrics (vLLM exposes tokens per phase). The 2026 state of the art is a mature stack for
infrastructure and an emerging one for LLM-specific resolution, exactly the crossing
that the reproducible harness (S4) has to build by hand. Acknowledging it avoids promising a
per-token accuracy that the general-purpose tools do not deliver on their own.&lt;/p>
&lt;hr>
&lt;h2 id="limits-and-traps-data-driven">Limits and traps (data-driven)&lt;/h2>
&lt;ol>
&lt;li>&lt;strong>Uncalibrated estimation.&lt;/strong> Kepler estimates; without calibrating against a power meter at
least once, the figure can carry a noticeable error, especially when it falls back on
regression models.&lt;/li>
&lt;li>&lt;strong>Forgetting the &lt;code>dcgmEndpoint&lt;/code>.&lt;/strong> Without pointing Kepler at the dcgm-exporter, GPU (and
MIG) attribution does not work; it is the key parameter for GPU.&lt;/li>
&lt;li>&lt;strong>Accounting for overhead badly.&lt;/strong> The bulk of the cost of measuring is in Prometheus; if
you stand it up just for energy, budget for it (1.5 cores, 15 GB).&lt;/li>
&lt;li>&lt;strong>Confusing bench and production.&lt;/strong> Zeus measures one workload finely; Kepler attributes
continuously in production. Using one for the other gives the wrong figure.&lt;/li>
&lt;li>&lt;strong>Misaligned windows.&lt;/strong> For energy per token, the power window and the token window must
coincide; if they do not, the J/token does not correspond.&lt;/li>
&lt;/ol>
&lt;p>With the measurement stack in place, the energy track has its instrumentation; the following
articles (C6 carbon, C8 TCO and regulation) build on this data. The foundation is this: a
continuous per-pod measurement, calibrated, on top of the observability infrastructure you
already have.&lt;/p>
&lt;h2 id="closing">Closing&lt;/h2>
&lt;p>Measuring the energy of an AI cluster in production does not require a new system: it requires
adding Kepler, per-pod attribution via eBPF, to the DCGM, Prometheus and Grafana stack you
already have for observability. That is the central idea of C3: the cost of measuring is almost
entirely in the Prometheus you already pay for, and Kepler turns it from &amp;ldquo;card power&amp;rdquo; into
&amp;ldquo;energy per pod, per team and per token&amp;rdquo;. With two cautions that separate a credible figure
from a decorative panel: calibrate once against a power meter (to have an error bar that
survives an audit) and point the &lt;code>dcgmEndpoint&lt;/code> (without which the GPU is not attributed).
Done that way, energy stops being the soft axis of sustainability and becomes an actionable
time series: the J/token per model that exposes inefficiency, the hourly carbon that enables
clean scheduling, the idle that gets recovered, and the CSRD report that holds up. For the
sovereign platform, the Kepler+DCGM stack closes the energy loop just as OpenCost closes the
cost one, and together, with GuideLLM&amp;rsquo;s goodput, they give the three faces of the dashboard
measured on the same iron, in euros, joules and grams of CO₂.&lt;/p>
&lt;h2 id="see-also">See also&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/mlperf-power-energy-efficiency-benchmark/">MLPerf Power&lt;/a> — the standard measurement at the wall (PTDaemon), complementary to software instrumentation (DCGM/RAPL/Kepler).&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/measuring-gpu-power-nvml-dcgm-sampling-errors/">Measuring the power of a GPU: NVML, DCGM and sampling errors&lt;/a> — the sensor metrology that feeds all these tools: averaging window, cumulative counter and what falls outside the counter.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/llm-energy-leaderboards-wh-per-token/">LLM energy efficiency leaderboards&lt;/a> — where the J/token these tools produce end up: the public rankings and how to interpret them without being misled by the setup.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/watt-to-carbon-pue-grid-intensity-gco2-per-token/">From watt to carbon: PUE, grid intensity and the real cost of a token&lt;/a> — the conversion step from measured watts to gCO₂eq and to euros, applying datacenter PUE and the country&amp;rsquo;s electricity grid intensity.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/levers-fewer-watts-per-token-llm-inference/">Energy efficiency levers in LLM inference&lt;/a> — the optimisations that reduce the consumption these tools measure: quantization, batching, engine and power schedulers.&lt;/li>
&lt;/ul>
&lt;h2 id="sources">Sources&lt;/h2>
&lt;ul>
&lt;li>Kepler · GitHub (CNCF, eBPF, por pod/nodo) — &lt;a href="https://github.com/sustainable-computing-io/kepler">https://github.com/sustainable-computing-io/kepler&lt;/a>&lt;/li>
&lt;li>Kepler · configuración (fuentes, dcgmEndpoint para MIG) — &lt;a href="https://github.com/sustainable-computing-io/kepler/blob/main/docs/user/configuration.md">https://github.com/sustainable-computing-io/kepler/blob/main/docs/user/configuration.md&lt;/a>&lt;/li>
&lt;li>CNCF · explorando Kepler (consumo de aplicaciones cloud) — &lt;a href="https://www.cncf.io/blog/2023/10/11/exploring-keplers-potentials-unveiling-cloud-application-power-consumption/">https://www.cncf.io/blog/2023/10/11/exploring-keplers-potentials-unveiling-cloud-application-power-consumption/&lt;/a>&lt;/li>
&lt;li>Red Hat · Kepler: monitorización eficiente de energía para Kubernetes — &lt;a href="https://next.redhat.com/2023/08/22/introducing-kepler-efficient-power-monitoring-for-kubernetes/">https://next.redhat.com/2023/08/22/introducing-kepler-efficient-power-monitoring-for-kubernetes/&lt;/a>&lt;/li>
&lt;li>arXiv · Container-level Energy Observability in Kubernetes (overhead) — &lt;a href="https://arxiv.org/pdf/2504.10702">https://arxiv.org/pdf/2504.10702&lt;/a>&lt;/li>
&lt;li>NVIDIA · dcgm-exporter — &lt;a href="https://github.com/NVIDIA/dcgm-exporter">https://github.com/NVIDIA/dcgm-exporter&lt;/a>&lt;/li>
&lt;li>Zeus Project (ml.energy) — &lt;a href="https://ml.energy/zeus/">https://ml.energy/zeus/&lt;/a>&lt;/li>
&lt;/ul></description></item><item><title>Runbook: caging the AI agent — bubblewrap on the client, Tetragon on the cluster</title><link>https://blog.lo0.es/en/posts/runbook-caging-ai-agent-bubblewrap-tetragon/</link><pubDate>Tue, 09 Jun 2026 17:00:00 +0200</pubDate><guid>https://blog.lo0.es/en/posts/runbook-caging-ai-agent-bubblewrap-tetragon/</guid><description>&lt;blockquote>
&lt;p>&lt;strong>Operational&lt;/strong> companion to &lt;a href="https://blog.lo0.es/en/posts/isolating-ai-agents-workstation-to-cluster/">The contractor with the master key&lt;/a>. That post explains the &lt;em>why&lt;/em> and the &lt;em>where&lt;/em>: the threat model, the five isolation families, which domain uses each. This one is the &lt;em>how&lt;/em>, with commands. If you have not read it, read it first: here I take for granted what the blast radius is, why &lt;code>bwrap&lt;/code> runs without root and what Tetragon watches. The procedure comes in two independent tracks, &lt;strong>client&lt;/strong> and &lt;strong>cluster&lt;/strong>, because, as the sibling post argues, the control extrapolates but the primitive gets rewritten.&lt;/p>
&lt;/blockquote>
&lt;h2 id="tldr">TL;DR&lt;/h2>
&lt;p>Two reproducible procedures. &lt;strong>Client (workstation):&lt;/strong> install &lt;code>ai-jail&lt;/code> (it wraps &lt;code>bubblewrap&lt;/code>), generate the per-project &lt;code>.ai-jail&lt;/code>, audit with &lt;code>--dry-run&lt;/code>, fix the allowlists with &lt;code>--bootstrap&lt;/code>, use &lt;code>--lockdown&lt;/code> for anything you do not trust, and leave the agent without &lt;code>git push&lt;/code> permission. &lt;strong>Cluster (RKE2 with Cilium + Tetragon):&lt;/strong> put the pod baseline in place (unprivileged &lt;code>securityContext&lt;/code>, &lt;code>seccomp: RuntimeDefault&lt;/code>, default-deny &lt;code>NetworkPolicy&lt;/code>), put the untrusted agent&amp;rsquo;s pod in a microVM with &lt;code>runtimeClassName: kata&lt;/code>, and deploy the Tetragon &lt;code>TracingPolicy&lt;/code> files in &lt;strong>two phases&lt;/strong>: observe with &lt;code>action: Post&lt;/code> to raise the baseline, then promote to &lt;code>action: Sigkill&lt;/code> on &lt;code>tcp_connect&lt;/code> (egress) and &lt;code>security_file_open&lt;/code> (secret paths). The golden rule of the Tetragon phase: &lt;strong>adopt first, block later&lt;/strong>; never put a &lt;code>Sigkill&lt;/code> into production without having seen the events in observation mode first.&lt;/p>
&lt;h2 id="the-flow-of-the-two-tracks">The flow of the two tracks&lt;/h2>
&lt;div class="diagram" style="max-width:800px;margin:1.5rem auto;">
&lt;svg viewBox="0 0 800 250" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Two operational tracks: client (install, configure, bootstrap, lockdown) and cluster (baseline, RuntimeClass, observe, enforce)">
&lt;defs>&lt;marker id="rm2" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto">&lt;path d="M0,0 L10,5 L0,10 z" fill="#666"/>&lt;/marker>&lt;/defs>
&lt;text x="400" y="22" text-anchor="middle" font-family="sans-serif" font-size="13" font-weight="700" fill="currentColor">CLIENT track — workstation&lt;/text>
&lt;rect x="20" y="36" width="150" height="46" rx="7" fill="#d4ecff" stroke="#1f5fa8" stroke-width="1.4"/>
&lt;text x="95" y="56" text-anchor="middle" font-family="sans-serif" font-size="11" font-weight="600" fill="#0d3a66">1 · Install&lt;/text>
&lt;text x="95" y="72" text-anchor="middle" font-family="sans-serif" font-size="9.5" fill="#0d3a66">ai-jail + bwrap&lt;/text>
&lt;rect x="200" y="36" width="150" height="46" rx="7" fill="#d4ecff" stroke="#1f5fa8" stroke-width="1.4"/>
&lt;text x="275" y="56" text-anchor="middle" font-family="sans-serif" font-size="11" font-weight="600" fill="#0d3a66">2 · .ai-jail&lt;/text>
&lt;text x="275" y="72" text-anchor="middle" font-family="sans-serif" font-size="9.5" fill="#0d3a66">--dry-run&lt;/text>
&lt;rect x="380" y="36" width="150" height="46" rx="7" fill="#d4ecff" stroke="#1f5fa8" stroke-width="1.4"/>
&lt;text x="455" y="56" text-anchor="middle" font-family="sans-serif" font-size="11" font-weight="600" fill="#0d3a66">3 · --bootstrap&lt;/text>
&lt;text x="455" y="72" text-anchor="middle" font-family="sans-serif" font-size="9.5" fill="#0d3a66">allow/deny/ask&lt;/text>
&lt;rect x="560" y="36" width="150" height="46" rx="7" fill="#d4ecff" stroke="#1f5fa8" stroke-width="1.4"/>
&lt;text x="635" y="52" text-anchor="middle" font-family="sans-serif" font-size="11" font-weight="600" fill="#0d3a66">4 · lockdown&lt;/text>
&lt;text x="635" y="68" text-anchor="middle" font-family="sans-serif" font-size="9.5" fill="#0d3a66">+ git with no push&lt;/text>
&lt;path d="M170,59 L198,59" stroke="#666" stroke-width="1.5" fill="none" marker-end="url(#rm2)"/>
&lt;path d="M350,59 L378,59" stroke="#666" stroke-width="1.5" fill="none" marker-end="url(#rm2)"/>
&lt;path d="M530,59 L558,59" stroke="#666" stroke-width="1.5" fill="none" marker-end="url(#rm2)"/>
&lt;line x1="20" y1="118" x2="780" y2="118" stroke="#ccc" stroke-width="1" stroke-dasharray="3 3"/>
&lt;text x="400" y="150" text-anchor="middle" font-family="sans-serif" font-size="13" font-weight="700" fill="currentColor">CLUSTER track — RKE2 + Cilium/Tetragon&lt;/text>
&lt;rect x="20" y="164" width="150" height="46" rx="7" fill="#e6d9f2" stroke="#5a2db0" stroke-width="1.4"/>
&lt;text x="95" y="184" text-anchor="middle" font-family="sans-serif" font-size="11" font-weight="600" fill="#42208a">1 · Baseline&lt;/text>
&lt;text x="95" y="200" text-anchor="middle" font-family="sans-serif" font-size="9.5" fill="#42208a">secCtx+NetPol&lt;/text>
&lt;rect x="200" y="164" width="150" height="46" rx="7" fill="#e6d9f2" stroke="#5a2db0" stroke-width="1.4"/>
&lt;text x="275" y="184" text-anchor="middle" font-family="sans-serif" font-size="11" font-weight="600" fill="#42208a">2 · RuntimeClass&lt;/text>
&lt;text x="275" y="200" text-anchor="middle" font-family="sans-serif" font-size="9.5" fill="#42208a">kata microVM&lt;/text>
&lt;rect x="380" y="164" width="150" height="46" rx="7" fill="#fde9d6" stroke="#a85a00" stroke-width="1.6"/>
&lt;text x="455" y="184" text-anchor="middle" font-family="sans-serif" font-size="11" font-weight="600" fill="#8a4a00">3 · Observe&lt;/text>
&lt;text x="455" y="200" text-anchor="middle" font-family="sans-serif" font-size="9.5" fill="#8a4a00">Tetragon · Post&lt;/text>
&lt;rect x="560" y="164" width="150" height="46" rx="7" fill="#fbd4b8" stroke="#a85a00" stroke-width="1.8"/>
&lt;text x="635" y="184" text-anchor="middle" font-family="sans-serif" font-size="11" font-weight="600" fill="#8a4a00">4 · Enforce&lt;/text>
&lt;text x="635" y="200" text-anchor="middle" font-family="sans-serif" font-size="9.5" fill="#8a4a00">Tetragon · Sigkill&lt;/text>
&lt;path d="M170,187 L198,187" stroke="#666" stroke-width="1.5" fill="none" marker-end="url(#rm2)"/>
&lt;path d="M350,187 L378,187" stroke="#666" stroke-width="1.5" fill="none" marker-end="url(#rm2)"/>
&lt;path d="M530,187 L558,187" stroke="#666" stroke-width="1.5" fill="none" marker-end="url(#rm2)"/>
&lt;text x="400" y="236" text-anchor="middle" font-family="sans-serif" font-size="10" font-style="italic" fill="#555">adopt first (observe), block later (enforce)&lt;/text>
&lt;/svg>
&lt;/div>
&lt;hr>
&lt;h1 id="track-a--client-the-developers-workstation">Track A — Client (the developer&amp;rsquo;s workstation)&lt;/h1>
&lt;h2 id="a0--install-ai-jail-and-bubblewrap">A0 — Install ai-jail and bubblewrap&lt;/h2>
&lt;p>&lt;code>ai-jail&lt;/code> wraps the sandbox; on Linux it needs &lt;code>bubblewrap&lt;/code> separately, on macOS it needs no extra dependency.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># ai-jail (macOS and Linux)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">brew tap akitaonrails/tap &lt;span class="o">&amp;amp;&amp;amp;&lt;/span> brew install ai-jail
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># or, with cargo:&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">cargo install ai-jail
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># or, with mise:&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">mise use -g ubi:akitaonrails/ai-jail
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># bubblewrap on Linux (pick your distro)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo pacman -S bubblewrap &lt;span class="c1"># Arch&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo apt install bubblewrap &lt;span class="c1"># Debian / Ubuntu&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo dnf install bubblewrap &lt;span class="c1"># Fedora&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Check the binary is there and that &lt;code>bwrap&lt;/code> runs without root (it must not ask for &lt;code>sudo&lt;/code>):&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">ai-jail --version
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">bwrap --ro-bind / / --unshare-all &lt;span class="nb">echo&lt;/span> &lt;span class="s2">&amp;#34;bwrap ok without root&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>If &lt;code>bwrap&lt;/code> fails asking for privileges, your kernel has &lt;em>unprivileged user namespaces&lt;/em> disabled; enable them (&lt;code>sysctl kernel.unprivileged_userns_clone=1&lt;/code> on older Debian/Ubuntu) before continuing.&lt;/p>
&lt;h2 id="a1--the-per-project-ai-jail-file">A1 — The per-project .ai-jail file&lt;/h2>
&lt;p>On the first launch inside the project, &lt;code>ai-jail&lt;/code> creates a &lt;code>.ai-jail&lt;/code> (TOML) that is &lt;strong>committable to the repo&lt;/strong>: any colleague who clones inherits the same policy.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">&lt;span class="nb">cd&lt;/span> ~/Projects/mi-app
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">ai-jail claude &lt;span class="c1"># creates .ai-jail and launches Claude Code inside the sandbox&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The generated file:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-toml" data-lang="toml">&lt;span class="line">&lt;span class="cl">&lt;span class="c"># .ai-jail — sandbox configuration (commit it to the repo)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nx">command&lt;/span> &lt;span class="p">=&lt;/span> &lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;claude&amp;#34;&lt;/span>&lt;span class="p">]&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nx">rw_maps&lt;/span> &lt;span class="p">=&lt;/span> &lt;span class="p">[]&lt;/span> &lt;span class="c"># extra writable directories&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nx">ro_maps&lt;/span> &lt;span class="p">=&lt;/span> &lt;span class="p">[]&lt;/span> &lt;span class="c"># extra read-only directories&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;strong>Before trusting the sandbox, audit it.&lt;/strong> &lt;code>--dry-run --verbose&lt;/code> prints every mount point, every isolation flag and the full &lt;code>bwrap&lt;/code> command, without executing anything:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">ai-jail --dry-run --verbose claude
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Read the output and confirm three things: that &lt;code>$HOME&lt;/code> is mounted as a tmpfs (not the real one), that &lt;code>~/.ssh&lt;/code>, &lt;code>~/.aws&lt;/code> and &lt;code>~/.gnupg&lt;/code> &lt;strong>do not appear&lt;/strong> among the mounts, and that the only writable directory is the project one. If you need an extra directory:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">ai-jail --rw-map ~/Projects/shared-lib claude &lt;span class="c1"># extra, writable&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">ai-jail --map /opt/datasets claude &lt;span class="c1"># extra, read-only&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Other agents, same binary:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">ai-jail codex
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">ai-jail opencode
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">ai-jail bash &lt;span class="c1"># bare shell to debug the sandbox&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">ai-jail -- python script.py &lt;span class="c1"># any command&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="a2--permission-allowlists-with---bootstrap">A2 — Permission allowlists with &amp;ndash;bootstrap&lt;/h2>
&lt;p>&lt;code>--bootstrap&lt;/code> generates each agent&amp;rsquo;s permission configuration, with sensible allow/deny/ask, and takes a backup before overwriting:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">ai-jail --bootstrap
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>What it produces, in summary:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Agent&lt;/th>
&lt;th>File&lt;/th>
&lt;th>Base policy&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>Claude Code&lt;/td>
&lt;td>&lt;code>~/.claude/settings.json&lt;/code>&lt;/td>
&lt;td>&lt;strong>allow&lt;/strong>: &lt;code>git status/diff/log&lt;/code>, &lt;code>ls&lt;/code>, &lt;code>grep&lt;/code>, &lt;code>cargo&lt;/code>, &lt;code>npm&lt;/code>, &lt;code>python&lt;/code>, &lt;code>docker compose&lt;/code> · &lt;strong>ask&lt;/strong>: &lt;code>git push&lt;/code>, &lt;code>rm&lt;/code>, &lt;code>docker run&lt;/code> · &lt;strong>deny&lt;/strong>: &lt;code>rm -rf&lt;/code>, &lt;code>sudo&lt;/code>, &lt;code>chmod 777&lt;/code>, &lt;code>git push --force&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Codex&lt;/td>
&lt;td>&lt;code>~/.codex/config.toml&lt;/code>&lt;/td>
&lt;td>&lt;code>approval_policy = &amp;quot;on-request&amp;quot;&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>OpenCode&lt;/td>
&lt;td>&lt;code>~/.config/opencode/opencode.json&lt;/code>&lt;/td>
&lt;td>permissions for &lt;code>bash&lt;/code>, &lt;code>edit&lt;/code>, &lt;code>write&lt;/code>&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>The operational key: &lt;code>git push&lt;/code> is under &lt;strong>ask&lt;/strong>, not &lt;strong>allow&lt;/strong>, and &lt;code>git push --force&lt;/code> under &lt;strong>deny&lt;/strong>. The agent can commit, branch and rebase locally as much as it wants; none of that touches the remote. (If you use the Claude Code &lt;code>/sandbox&lt;/code>, also set &lt;code>&amp;quot;allowUnsandboxedCommands&amp;quot;: false&lt;/code> to close the &lt;code>dangerouslyDisableSandbox&lt;/code> &lt;em>escape hatch&lt;/em>, which is opt-out out of the box.)&lt;/p>
&lt;h2 id="a3--lockdown-for-anything-you-do-not-trust">A3 — Lockdown for anything you do not trust&lt;/h2>
&lt;p>To audit third-party code or run an agent over a project you do not know, &lt;code>--lockdown&lt;/code> goes further: project mounted &lt;strong>read-only&lt;/strong>, GPU/Docker/display disabled, &lt;code>--rw-map&lt;/code>/&lt;code>--map&lt;/code> ignored, &lt;code>$HOME&lt;/code> a pure tmpfs with no host dotfiles, network cut with &lt;code>--unshare-net&lt;/code> and the environment wiped with &lt;code>--clearenv&lt;/code>.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">ai-jail --lockdown bash
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>It is the most restrictive sandbox possible short of a VM. Use it as your mental default for anything that is not your own code on your own machine.&lt;/p>
&lt;h2 id="a4--the-safety-net-git-with-no-push">A4 — The safety net: git with no push&lt;/h2>
&lt;p>It is not a flag, it is a property of the environment that changes the risk arithmetic. If the project is in git with a remote, and the agent does &lt;strong>not&lt;/strong> have &lt;code>push&lt;/code> permission, the worst case, that it corrupts every file in the project, is reverted with:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">git checkout . &lt;span class="c1"># back to the last commit&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># and if it touched .git (unlikely): delete the dir and re-clone&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The remote was never touched. &lt;strong>Sandbox for the filesystem + git for the code + manual push&lt;/strong> is already a reasonable level for daily use: &lt;code>ai-jail&lt;/code> protects your data and the system, git protects the code, and the decision to publish is still yours.&lt;/p>
&lt;hr>
&lt;h1 id="track-b--cluster-rke2-with-cilium--tetragon">Track B — Cluster (RKE2 with Cilium + Tetragon)&lt;/h1>
&lt;p>The untrusted agent, or the inference that executes generated code, runs as a pod. The same principle as on the client, different primitives. We assume a generic RKE2 cluster with Cilium as CNI and Tetragon already deployed (the eBPF agent &lt;code>DaemonSet&lt;/code> on every node).&lt;/p>
&lt;h2 id="b0--the-pod-baseline">B0 — The pod baseline&lt;/h2>
&lt;p>Before any eBPF, the standard kit. Unprivileged &lt;code>securityContext&lt;/code>, read-only root, default seccomp:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-yaml" data-lang="yaml">&lt;span class="line">&lt;span class="cl">&lt;span class="nt">apiVersion&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">v1&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">kind&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">Pod&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">metadata&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">ai-agent&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">namespace&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">agentes&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">labels&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">app&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">ai-agent&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">spec&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">securityContext&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">runAsNonRoot&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="kc">true&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">runAsUser&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">10001&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">seccompProfile&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">type&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">RuntimeDefault&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">containers&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">agent&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">image&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">registry.interno/ai-agent:pinned&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">securityContext&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">allowPrivilegeEscalation&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="kc">false&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">readOnlyRootFilesystem&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="kc">true&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">capabilities&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">drop&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;ALL&amp;#34;&lt;/span>&lt;span class="p">]&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">volumeMounts&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- {&lt;span class="w"> &lt;/span>&lt;span class="nt">name: work, mountPath&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">/work } &lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c"># the only writable one&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">volumes&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">work&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">emptyDir&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>{}&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>And the default egress cut, the cluster twin of &lt;code>--unshare-net&lt;/code>. A default-deny egress NetworkPolicy in the namespace, opening only DNS and the bare essentials:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-yaml" data-lang="yaml">&lt;span class="line">&lt;span class="cl">&lt;span class="nt">apiVersion&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">networking.k8s.io/v1&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">kind&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">NetworkPolicy&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">metadata&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">default-deny-egress&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">namespace&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">agentes&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">spec&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">podSelector&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>{}&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">policyTypes&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;Egress&amp;#34;&lt;/span>&lt;span class="p">]&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">egress&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">to&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">namespaceSelector&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">matchLabels&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>{&lt;span class="w"> &lt;/span>&lt;span class="nt">kubernetes.io/metadata.name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">kube-system }&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">ports&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- {&lt;span class="w"> &lt;/span>&lt;span class="nt">protocol: UDP, port&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">53&lt;/span>&lt;span class="w"> &lt;/span>}&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- {&lt;span class="w"> &lt;/span>&lt;span class="nt">protocol: TCP, port&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">53&lt;/span>&lt;span class="w"> &lt;/span>}&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="b1--kata-runtimeclass-the-untrusted-pod-in-its-own-microvm">B1 — Kata RuntimeClass: the untrusted pod in its own microVM&lt;/h2>
&lt;p>For genuinely untrusted code, take it out of the shared kernel. With Kata deployed there is a &lt;code>RuntimeClass&lt;/code>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-yaml" data-lang="yaml">&lt;span class="line">&lt;span class="cl">&lt;span class="nt">apiVersion&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">node.k8s.io/v1&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">kind&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">RuntimeClass&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">metadata&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">kata&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">handler&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">kata&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>And the pod asks for it with one line, &lt;code>runtimeClassName: kata&lt;/code>, running in its own microVM with a dedicated kernel instead of sharing the node&amp;rsquo;s:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-yaml" data-lang="yaml">&lt;span class="line">&lt;span class="cl">&lt;span class="nt">spec&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">runtimeClassName&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">kata &lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c"># ← the pod runs in a microVM, not on the node&amp;#39;s kernel&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="c"># ...the rest the same as B0&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>It is the cluster twin of isolation by construction: a kernel exploit inside the pod does not reach the node.&lt;/p>
&lt;h2 id="b2--tetragon-observation-phase-post">B2 — Tetragon, observation phase (Post)&lt;/h2>
&lt;p>Now the layer that separates a platform with runtime visibility from one without. &lt;strong>Observe first, never kill from the outset.&lt;/strong> A &lt;code>TracingPolicyNamespaced&lt;/code>, scoped to the namespace and to the agent&amp;rsquo;s label, that reports (does not kill) three things: process executions, network connections and opens of sensitive paths. &lt;code>action: Post&lt;/code> only emits the event.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-yaml" data-lang="yaml">&lt;span class="line">&lt;span class="cl">&lt;span class="nt">apiVersion&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">cilium.io/v1alpha1&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">kind&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">TracingPolicyNamespaced&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">metadata&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">agente-observa&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">namespace&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">agentes&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">spec&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">podSelector&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">matchLabels&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">app&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">ai-agent&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">kprobes&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="c"># --- outbound connections ---&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">call&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;tcp_connect&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">syscall&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="kc">false&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">args&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">index&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">0&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">type&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;sock&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">selectors&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">matchActions&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">action&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">Post&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="c"># --- opens of sensitive files ---&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">call&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;security_file_open&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">syscall&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="kc">false&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">args&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">index&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">0&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">type&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;file&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">selectors&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">matchArgs&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">index&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">0&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">operator&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;Prefix&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">values&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="s2">&amp;#34;/var/run/secrets&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="s2">&amp;#34;/work/.git/config&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">matchActions&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">action&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">Post&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>(Process executions need no kprobe: Tetragon emits &lt;code>process_exec&lt;/code>/&lt;code>process_exit&lt;/code> natively.) Deploy it and watch the events live from the node&amp;rsquo;s Tetragon pod:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">kubectl apply -f agente-observa.yaml
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># readable events, filtered by namespace:&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">kubectl &lt;span class="nb">exec&lt;/span> -n kube-system ds/tetragon -c tetragon -- &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> tetra getevents -o compact --namespace agentes
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Leave this running for a typical working day of the agent. Note &lt;strong>which destinations&lt;/strong> it really connects to (your internal registry, your HF mirror, your vLLM endpoint) and &lt;strong>which paths&lt;/strong> it opens. That is your baseline: the list of what is legitimate. Without this step, a &lt;code>Sigkill&lt;/code> kills good work and generates an availability incident, precisely what ENS asks you to avoid.&lt;/p>
&lt;h2 id="b3--tetragon-enforcement-phase-sigkill">B3 — Tetragon, enforcement phase (Sigkill)&lt;/h2>
&lt;p>With the baseline in hand, promote to blocking. Two rules. The first: &lt;strong>kill any connection whose destination is not on the allowlist&lt;/strong> — &lt;code>NotDAddr&lt;/code> inverts the match: it fires for everything that is &lt;em>not&lt;/em> those networks. The second: &lt;strong>kill any attempt to open a secrets path&lt;/strong>.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-yaml" data-lang="yaml">&lt;span class="line">&lt;span class="cl">&lt;span class="nt">apiVersion&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">cilium.io/v1alpha1&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">kind&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">TracingPolicyNamespaced&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">metadata&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">agente-enforce&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">namespace&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">agentes&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">spec&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">podSelector&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">matchLabels&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">app&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">ai-agent&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">kprobes&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="c"># --- egress: kill everything that is NOT on the allowlist ---&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">call&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;tcp_connect&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">syscall&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="kc">false&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">args&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">index&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">0&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">type&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;sock&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">selectors&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">matchArgs&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">index&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">0&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">operator&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;NotDAddr&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">values&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="s2">&amp;#34;127.0.0.1&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="s2">&amp;#34;10.0.0.0/8&amp;#34;&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c"># internal cluster network&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="s2">&amp;#34;172.16.10.20&amp;#34;&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c"># internal registry (example)&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">matchActions&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">action&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">Sigkill&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="c"># --- reading secrets: kill the process ---&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">call&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;security_file_open&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">syscall&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="kc">false&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">args&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">index&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">0&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">type&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;file&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">selectors&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">matchArgs&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">index&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">0&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">operator&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;Prefix&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">values&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="s2">&amp;#34;/var/run/secrets/kubernetes.io/serviceaccount/token&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="s2">&amp;#34;/work/.ssh&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">matchActions&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">action&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">Sigkill&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">kubectl apply -f agente-enforce.yaml
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Now the agent can do whatever it likes inside the pod, but &lt;strong>the instant&lt;/strong> it tries to connect to a disallowed destination or read the service account token, Tetragon kills it in the kernel, before the packet leaves or the &lt;code>read&lt;/code> returns bytes. It is the cluster twin of the &lt;code>curl&lt;/code> blocklist and the unmounted &lt;code>~/.ssh&lt;/code>, but applied at runtime and over &lt;em>any&lt;/em> binary, not just the ones you know about.&lt;/p>
&lt;blockquote>
&lt;p>&lt;strong>Operational warning.&lt;/strong> Enforcement with &lt;code>Sigkill&lt;/code> requires a recent kernel with eBPF support for the action (5.10+ is safe). Deploy &lt;code>agente-enforce&lt;/code> in a test namespace first, and keep &lt;code>agente-observa&lt;/code> active in parallel: if the block fires, the &lt;code>Post&lt;/code> event tells you exactly what triggered it. Adopt first, block later.&lt;/p>
&lt;/blockquote>
&lt;h2 id="the-client--cluster-equivalence-table">The client ↔ cluster equivalence table&lt;/h2>
&lt;p>The same vector, the two primitives. This is &amp;ldquo;extrapolating the technology&amp;rdquo; made explicit:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Threat vector&lt;/th>
&lt;th>Client (workstation)&lt;/th>
&lt;th>Cluster (RKE2)&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;code>$HOME&lt;/code> / writable root&lt;/td>
&lt;td>&lt;code>$HOME&lt;/code> as ephemeral tmpfs (&lt;code>bwrap&lt;/code>)&lt;/td>
&lt;td>&lt;code>readOnlyRootFilesystem: true&lt;/code> + &lt;code>emptyDir&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Arbitrary egress&lt;/td>
&lt;td>&lt;code>curl&lt;/code>/&lt;code>wget&lt;/code> blocklist · &lt;code>--unshare-net&lt;/code>&lt;/td>
&lt;td>default-deny NetworkPolicy + Tetragon &lt;code>NotDAddr&lt;/code>→&lt;code>Sigkill&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Reading secrets&lt;/td>
&lt;td>&lt;code>~/.ssh&lt;/code>/&lt;code>~/.aws&lt;/code>/&lt;code>~/.gnupg&lt;/code> not mounted&lt;/td>
&lt;td>secrets outside the pod + Tetragon &lt;code>security_file_open&lt;/code>→&lt;code>Sigkill&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Kernel escape&lt;/td>
&lt;td>Landlock (2nd VFS barrier)&lt;/td>
&lt;td>&lt;code>runtimeClassName: kata&lt;/code> (microVM, own kernel)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>No escape hatch&lt;/td>
&lt;td>process inside &lt;code>bwrap&lt;/code>, no way out&lt;/td>
&lt;td>no &lt;code>privileged&lt;/code>, &lt;code>drop ALL&lt;/code>, &lt;code>allowPrivilegeEscalation:false&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Damage to the code&lt;/td>
&lt;td>git remote with no &lt;code>push&lt;/code> → &lt;code>git checkout .&lt;/code>&lt;/td>
&lt;td>GitOps + PR review, the agent does not apply to &lt;code>main&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Visibility&lt;/td>
&lt;td>&lt;code>--dry-run --verbose&lt;/code> (static, pre-run)&lt;/td>
&lt;td>Tetragon &lt;code>tetra getevents&lt;/code> (dynamic, at runtime)&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;h2 id="checklist-of-gotchas">Checklist of gotchas&lt;/h2>
&lt;ul>
&lt;li>&lt;strong>Do not put in a &lt;code>Sigkill&lt;/code> without passing through &lt;code>Post&lt;/code>.&lt;/strong> The observation baseline is not optional: it is what separates &amp;ldquo;blocking a C2&amp;rdquo; from &amp;ldquo;killing your own fine-tuning job&amp;rdquo;.&lt;/li>
&lt;li>&lt;strong>The &lt;code>.ai-jail&lt;/code> gets committed; secrets do not.&lt;/strong> The TOML is policy, not credentials. Check you are not putting paths holding sensitive data into &lt;code>rw_maps&lt;/code>.&lt;/li>
&lt;li>&lt;strong>&lt;code>readOnlyRootFilesystem&lt;/code> breaks apps that write to &lt;code>/tmp&lt;/code>.&lt;/strong> Mount an &lt;code>emptyDir&lt;/code> at &lt;code>/tmp&lt;/code> as well as the work one.&lt;/li>
&lt;li>&lt;strong>A NetworkPolicy with no DNS rule leaves the pod blind.&lt;/strong> Open port 53 to &lt;code>kube-system&lt;/code> or nothing resolves.&lt;/li>
&lt;li>&lt;strong>Kata is not free.&lt;/strong> It adds startup latency and not every workload with special devices (GPU passthrough) fits; reserve it for the untrusted, not for everything.&lt;/li>
&lt;li>&lt;strong>The Claude Code &lt;code>/sandbox&lt;/code> does not cover MCP or hooks&lt;/strong> unless you enable &lt;code>sandbox-runtime&lt;/code>. If your agent uses MCP servers, assume they run with full permissions until you do.&lt;/li>
&lt;li>&lt;strong>&lt;code>NotDAddr&lt;/code> with literal IPs ages badly.&lt;/strong> Document the allowlist and review it when the registry or the inference endpoint changes; consider stable internal CIDRs instead of loose IPs.&lt;/li>
&lt;/ul>
&lt;h2 id="see-also">See also&lt;/h2>
&lt;ul>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/hardening-secrets-sovereign-llm-stack-defence-in-depth/">Hardening and secrets in the sovereign LLM stack: defence in depth&lt;/a> — the hardening of the whole cluster beyond agent isolation.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/isolating-ai-agents-workstation-to-cluster/">The contractor with the master key: isolating AI agents from workstation to cluster&lt;/a> — the landscape this runbook executes: threat model, the five isolation families and why client and cluster use different primitives.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/network-numa-cilium-ebpf-dranet-fourth-leg-pinning/">The kitchen door the maître never checked: Cilium eBPF and DRANET&lt;/a> — the Cilium eBPF layer on which Tetragon hooks its kprobes; the datapath you already have in the cluster.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/technical-controls-ens-iso-42001-eu-ai-act-cross-mapping/">Technical controls: ENS × ISO 42001 × EU AI Act&lt;/a> — Tetragon events as technical evidence for &lt;code>op.mon&lt;/code>/&lt;code>op.exp&lt;/code>; enforcement as a protection measure.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/llm-guardrails-safety-four-lines-of-defence/">Guardrails and safety in LLMs&lt;/a> — mitigation on the content plane; this runbook, on the execution plane.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/greenfield-deployment-phases-on-premise-llm-platform/">Seven phases of deploying an on-premise LLM platform&lt;/a> — where runtime hardening fits in the deployment sequence (F4 identity/policies, F5 platform).&lt;/p>
&lt;/li>
&lt;/ul>
&lt;h2 id="references">References&lt;/h2>
&lt;ul>
&lt;li>ai-jail (Fabio Akita), GPL-3.0: &lt;a href="https://github.com/akitaonrails/ai-jail">https://github.com/akitaonrails/ai-jail&lt;/a>&lt;/li>
&lt;li>bubblewrap: &lt;a href="https://github.com/containers/bubblewrap">https://github.com/containers/bubblewrap&lt;/a>&lt;/li>
&lt;li>Landlock LSM: &lt;a href="https://landlock.io">https://landlock.io&lt;/a>&lt;/li>
&lt;li>Tetragon — TracingPolicy: &lt;a href="https://tetragon.io/docs/concepts/tracing-policy/">https://tetragon.io/docs/concepts/tracing-policy/&lt;/a>&lt;/li>
&lt;li>Tetragon — enforcement (Sigkill/Override): &lt;a href="https://tetragon.io/docs/concepts/enforcement/">https://tetragon.io/docs/concepts/enforcement/&lt;/a>&lt;/li>
&lt;li>Kata Containers — Kubernetes RuntimeClass: &lt;a href="https://katacontainers.io">https://katacontainers.io&lt;/a>&lt;/li>
&lt;li>Kubernetes — Pod Security &amp;amp; seccomp: &lt;a href="https://kubernetes.io/docs/tutorials/security/seccomp/">https://kubernetes.io/docs/tutorials/security/seccomp/&lt;/a>&lt;/li>
&lt;li>Kubernetes — Network Policies: &lt;a href="https://kubernetes.io/docs/concepts/services-networking/network-policies/">https://kubernetes.io/docs/concepts/services-networking/network-policies/&lt;/a>&lt;/li>
&lt;li>Cilium: &lt;a href="https://cilium.io">https://cilium.io&lt;/a>&lt;/li>
&lt;/ul></description></item><item><title>The contractor with the master key: isolating AI agents from workstation to cluster</title><link>https://blog.lo0.es/en/posts/isolating-ai-agents-workstation-to-cluster/</link><pubDate>Tue, 09 Jun 2026 16:00:00 +0200</pubDate><guid>https://blog.lo0.es/en/posts/isolating-ai-agents-workstation-to-cluster/</guid><description>&lt;blockquote>
&lt;p>First post of a pair on &lt;strong>AI agent isolation&lt;/strong>. This one fixes the &lt;em>what&lt;/em> and the &lt;em>where&lt;/em>: the complete map of isolation primitives and which domain each belongs to. The &lt;a href="https://blog.lo0.es/en/posts/runbook-caging-ai-agent-bubblewrap-tetragon/">sibling runbook&lt;/a> fixes the &lt;em>how&lt;/em>, with commands: &lt;code>ai-jail&lt;/code> and bubblewrap on the client, Tetragon &lt;code>TracingPolicy&lt;/code> and &lt;code>RuntimeClass&lt;/code> on the cluster. If you are only going to read one, this one gives you the mental model; the other one gives you the files to copy and paste.&lt;/p>
&lt;/blockquote>
&lt;h2 id="tldr">TL;DR&lt;/h2>
&lt;p>An AI agent that runs code needs access to your filesystem and your tools: compiler, linter, &lt;code>grep&lt;/code>, &lt;code>make&lt;/code>, &lt;code>cargo&lt;/code>, &lt;code>npm&lt;/code>. That is the minimum to be useful. The problem is that alongside that access travels the ability to read &lt;code>~/.aws/credentials&lt;/code>, exfiltrate your SSH keys or fire an &lt;code>rm -rf&lt;/code> outside the project directory. And no malicious model is needed: a compromised dependency in an &lt;code>npm install&lt;/code> is enough, because the well-meaning agent and the poisoned &lt;em>post-install script&lt;/em> &lt;strong>run with the same permissions&lt;/strong>. The answer is not to trust the LLM&amp;rsquo;s good intentions; it is to &lt;strong>isolate in order to bound the blast radius&lt;/strong>. This post walks the five isolation families of 2026, from the process sandbox to the full VM, and sorts them into two columns: what applies on the &lt;strong>client&lt;/strong> (the developer&amp;rsquo;s workstation: bubblewrap, &lt;code>ai-jail&lt;/code>, sandbox-exec, Landlock, the native Claude Code and Codex sandboxes) and what applies on the &lt;strong>cluster&lt;/strong> (where the agent or the inference runs on Kubernetes: namespaces+seccomp, gVisor, Firecracker/Kata microVMs and &lt;strong>eBPF/Tetragon&lt;/strong> as the layer for live observation and enforcement). The thesis: the threat model is the same in both places; the tools are not. Policy extrapolates; the primitive gets rewritten.&lt;/p>
&lt;h2 id="the-analogy-the-contractor-with-the-master-key">The analogy: the contractor with the master key&lt;/h2>
&lt;p>You hire a builder for a renovation. He is competent and acts in good faith. But two things happen that you do not control. The first: he may misread the instruction and knock down the wrong partition wall. The second, worse: his toolbox may have been tampered with before he came through your door — somebody put something inside — and when he opens it in your living room, that something activates.&lt;/p>
&lt;p>Nobody sensible gives him the &lt;strong>master key&lt;/strong> to the whole building. You open the room he works in, you leave him the tools he needs, and you keep the study with the safe and the server room locked. If the renovation goes wrong, by error or by sabotage, the damage stays in that room.&lt;/p>
&lt;p>An AI agent is that contractor. The sandbox is the key policy: &lt;strong>you give it the project room and the tools, not the master key to the system.&lt;/strong> And here is the twist that justifies two posts: the builder works in two different buildings. One is &lt;strong>your flat&lt;/strong>, the developer&amp;rsquo;s workstation, with your credentials, your &lt;code>~/.ssh&lt;/code>, the browser&amp;rsquo;s password vault. The other is &lt;strong>the datacenter&lt;/strong>, the cluster where inference and autonomous agents serve customers, with data from several tenants at once. The key policy is identical in both: least privilege, bound the radius. But the lock on your flat&amp;rsquo;s door is not the same as the one at the datacenter. In the flat you fit a cylinder lock (&lt;code>bubblewrap&lt;/code>). At the datacenter you put a guard watching every door and a separate wing of the building (Tetragon + microVM). Same principle, different hardware. That is &lt;strong>extrapolating the technology&lt;/strong>, not copying it.&lt;/p>
&lt;h2 id="the-threat-model-what-a-runaway-agent-can-do">The threat model: what a runaway agent can do&lt;/h2>
&lt;p>Before choosing a lock it helps to enumerate the burglar. The attack surface of an agent that executes arbitrary bash breaks down into five concrete threats. Not all are defended by the same layer and, an uncomfortable fact that the security documentation itself acknowledges, &lt;strong>no single layer covers them all&lt;/strong>.&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Threat&lt;/th>
&lt;th>What the agent does&lt;/th>
&lt;th>Minimum layer that cuts it&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;strong>Filesystem out of scope&lt;/strong>&lt;/td>
&lt;td>Reads &lt;code>.env&lt;/code>, &lt;code>~/.ssh/id_rsa&lt;/code>, system secrets; modifies sources outside the project&lt;/td>
&lt;td>Process sandbox (path allowlist)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Arbitrary network egress&lt;/strong>&lt;/td>
&lt;td>Exfiltrates data, receives instructions from a remote C2, calls unauthorised APIs&lt;/td>
&lt;td>Network blocking / NetworkPolicy / microVM&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Kernel syscall surface&lt;/strong>&lt;/td>
&lt;td>A kernel exploit from inside the container escalates to the host (shared kernel)&lt;/td>
&lt;td>gVisor or microVM (dedicated kernel)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Cross-tenant leakage&lt;/strong>&lt;/td>
&lt;td>One customer&amp;rsquo;s workload reads another&amp;rsquo;s data on a multi-tenant platform&lt;/td>
&lt;td>microVM (de facto standard)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Secret exfiltration&lt;/strong>&lt;/td>
&lt;td>Extracts tokens and environment variables via &lt;code>/proc&lt;/code> or the environment&lt;/td>
&lt;td>&lt;code>--clearenv&lt;/code> / tmpfs &lt;code>$HOME&lt;/code> / secrets outside the pod&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>There is a sixth threat that &lt;strong>no sandbox solves&lt;/strong>: &lt;em>prompt injection&lt;/em>. If an attacker manages to slip instructions into the agent&amp;rsquo;s context — a poisoned comment in the code, a malicious file the agent reads, an adversarial response from a tool — the agent will execute those instructions with whatever permissions the sandbox grants it. Isolation &lt;strong>shrinks the impact radius&lt;/strong> of a successful injection; it does not prevent the injection. That is why the sandbox is a layer, not the solution: on top go input validation, tool-call allowlists and output auditing. The sentence to internalise: &lt;em>isolation does not make the agent trustworthy; it bounds what an untrustworthy agent can break.&lt;/em>&lt;/p>
&lt;h2 id="two-domains-one-policy">Two domains, one policy&lt;/h2>
&lt;p>The builder works in two buildings. The distribution of tools reads better in two columns:&lt;/p>
&lt;div class="diagram" style="max-width:820px;margin:1.5rem auto;">
&lt;svg viewBox="0 0 820 430" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Two-column map: client domain (workstation) and cluster domain, with their isolation layers and the shared policy bridge">
&lt;defs>&lt;marker id="am" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto">&lt;path d="M0,0 L10,5 L0,10 z" fill="#666"/>&lt;/marker>&lt;/defs>
&lt;text x="410" y="26" text-anchor="middle" font-family="sans-serif" font-size="14" font-weight="700" fill="currentColor">Same least-privilege policy · different primitive&lt;/text>
&lt;!-- client column -->
&lt;rect x="24" y="46" width="360" height="350" rx="10" fill="#eef4fb" stroke="#1f5fa8" stroke-width="1.6"/>
&lt;text x="204" y="72" text-anchor="middle" font-family="sans-serif" font-size="14" font-weight="700" fill="#0d3a66">CLIENT · dev workstation&lt;/text>
&lt;text x="204" y="90" text-anchor="middle" font-family="sans-serif" font-size="11" fill="#0d3a66">one process, one user, personal data&lt;/text>
&lt;rect x="48" y="106" width="312" height="50" rx="6" fill="#d4ecff" stroke="#1f5fa8" stroke-width="1.2"/>
&lt;text x="204" y="126" text-anchor="middle" font-family="sans-serif" font-size="12" font-weight="600" fill="#0d3a66">Process sandbox&lt;/text>
&lt;text x="204" y="143" text-anchor="middle" font-family="sans-serif" font-size="10" fill="#0d3a66">bubblewrap (Linux) · sandbox-exec (macOS)&lt;/text>
&lt;rect x="48" y="166" width="312" height="42" rx="6" fill="#dff0ff" stroke="#1f5fa8" stroke-width="1.1"/>
&lt;text x="204" y="183" text-anchor="middle" font-family="sans-serif" font-size="12" font-weight="600" fill="#0d3a66">Landlock (LSM, 2nd VFS barrier)&lt;/text>
&lt;text x="204" y="199" text-anchor="middle" font-family="sans-serif" font-size="10" fill="#0d3a66">defence in depth, kernel ≥5.13&lt;/text>
&lt;rect x="48" y="218" width="312" height="42" rx="6" fill="#eaf4ff" stroke="#1f5fa8" stroke-width="1.1"/>
&lt;text x="204" y="235" text-anchor="middle" font-family="sans-serif" font-size="12" font-weight="600" fill="#0d3a66">Dev container (optional)&lt;/text>
&lt;text x="204" y="251" text-anchor="middle" font-family="sans-serif" font-size="10" fill="#0d3a66">reproducibility + reset, shared kernel&lt;/text>
&lt;text x="204" y="284" text-anchor="middle" font-family="sans-serif" font-size="11" font-weight="600" fill="#0d3a66">What wraps it:&lt;/text>
&lt;text x="204" y="304" text-anchor="middle" font-family="sans-serif" font-size="10.5" fill="#0d3a66">ai-jail · Claude Code /sandbox&lt;/text>
&lt;text x="204" y="320" text-anchor="middle" font-family="sans-serif" font-size="10.5" fill="#0d3a66">Codex --sandbox · Cursor /worktree&lt;/text>
&lt;text x="204" y="352" text-anchor="middle" font-family="sans-serif" font-size="10.5" fill="#0d3a66">Safety net: git remote with no push&lt;/text>
&lt;text x="204" y="376" text-anchor="middle" font-family="sans-serif" font-size="10.5" font-style="italic" fill="#555">startup ~0 ms · no daemon&lt;/text>
&lt;!-- cluster column -->
&lt;rect x="436" y="46" width="360" height="350" rx="10" fill="#f3eefb" stroke="#5a2db0" stroke-width="1.6"/>
&lt;text x="616" y="72" text-anchor="middle" font-family="sans-serif" font-size="14" font-weight="700" fill="#42208a">CLUSTER · inference / agents in prod&lt;/text>
&lt;text x="616" y="90" text-anchor="middle" font-family="sans-serif" font-size="11" fill="#42208a">multi-pod, multi-tenant, RKE2&lt;/text>
&lt;rect x="460" y="106" width="312" height="50" rx="6" fill="#e6d9f2" stroke="#5a2db0" stroke-width="1.2"/>
&lt;text x="616" y="126" text-anchor="middle" font-family="sans-serif" font-size="12" font-weight="600" fill="#42208a">Pod baseline&lt;/text>
&lt;text x="616" y="143" text-anchor="middle" font-family="sans-serif" font-size="10" fill="#42208a">namespaces + seccomp + cgroups + NetworkPolicy&lt;/text>
&lt;rect x="460" y="166" width="312" height="42" rx="6" fill="#ede1f7" stroke="#5a2db0" stroke-width="1.1"/>
&lt;text x="616" y="183" text-anchor="middle" font-family="sans-serif" font-size="12" font-weight="600" fill="#42208a">gVisor (runsc) — user-space kernel&lt;/text>
&lt;text x="616" y="199" text-anchor="middle" font-family="sans-serif" font-size="10" fill="#42208a">cuts the syscall surface to the host&lt;/text>
&lt;rect x="460" y="218" width="312" height="42" rx="6" fill="#f0e6fb" stroke="#5a2db0" stroke-width="1.1"/>
&lt;text x="616" y="235" text-anchor="middle" font-family="sans-serif" font-size="12" font-weight="600" fill="#42208a">Firecracker / Kata microVM — own kernel&lt;/text>
&lt;text x="616" y="251" text-anchor="middle" font-family="sans-serif" font-size="10" fill="#42208a">isolation by construction for untrusted code&lt;/text>
&lt;rect x="460" y="270" width="312" height="62" rx="6" fill="#fde9d6" stroke="#a85a00" stroke-width="1.6"/>
&lt;text x="616" y="290" text-anchor="middle" font-family="sans-serif" font-size="12" font-weight="700" fill="#8a4a00">eBPF / Tetragon (what we already have)&lt;/text>
&lt;text x="616" y="307" text-anchor="middle" font-family="sans-serif" font-size="10" fill="#8a4a00">watches every exec · connect · open in the kernel&lt;/text>
&lt;text x="616" y="322" text-anchor="middle" font-family="sans-serif" font-size="10" fill="#8a4a00">and kills (Sigkill) whatever strays from the script&lt;/text>
&lt;text x="616" y="356" text-anchor="middle" font-family="sans-serif" font-size="10.5" fill="#42208a">Safety net: GitOps + PR review&lt;/text>
&lt;text x="616" y="376" text-anchor="middle" font-family="sans-serif" font-size="10.5" font-style="italic" fill="#555">startup &amp;lt;1 s (microVM) · runtime layer always on&lt;/text>
&lt;!-- bridge -->
&lt;path d="M384,221 L436,221" stroke="#666" stroke-width="1.6" fill="none" marker-end="url(#am)"/>
&lt;path d="M436,241 L384,241" stroke="#666" stroke-width="1.6" fill="none" marker-end="url(#am)"/>
&lt;text x="410" y="415" text-anchor="middle" font-family="sans-serif" font-size="11" font-style="italic" fill="#555">extrapolate: each client control has its cluster analogue (equivalence table in the runbook)&lt;/text>
&lt;/svg>
&lt;/div>
&lt;h2 id="the-client-isolating-the-agent-on-the-workstation">The client: isolating the agent on the workstation&lt;/h2>
&lt;p>Here the agent is a coding assistant — Claude Code, Codex, OpenCode, Cursor — that a developer launches on their machine. One process, one user, and right next to it the juiciest assets that exist: &lt;code>~/.aws/credentials&lt;/code>, &lt;code>~/.ssh&lt;/code>, &lt;code>~/.gnupg&lt;/code>, the browser&amp;rsquo;s password store. The matching tier is the lightest one: the &lt;strong>process sandbox&lt;/strong>.&lt;/p>
&lt;p>&lt;strong>bubblewrap (Linux) and sandbox-exec (macOS).&lt;/strong> &lt;code>bubblewrap&lt;/code> (&lt;code>bwrap&lt;/code>) is the same sandbox Flatpak uses to isolate each desktop app: a ~50 KB binary, ~4,000 lines of C, maintained by the GNOME team and, the key property, it runs &lt;strong>without root&lt;/strong> via &lt;code>CLONE_NEWUSER&lt;/code>, creating namespaces with no elevated privileges. It mounts &lt;code>$HOME&lt;/code> as an ephemeral tmpfs and only exposes the project directory, writable; the rest of the system becomes invisible. On macOS the equivalent is &lt;code>sandbox-exec&lt;/code> with SBPL profiles: a legacy Apple API, officially deprecated and with no public replacement, but working today. Parity between the two is not exact — on macOS the GPU (Metal) and the display (Cocoa) are system services and &lt;code>sandbox-exec&lt;/code> does not restrict them — but both protect what matters: access to the sensitive areas of the filesystem.&lt;/p>
&lt;p>&lt;strong>Landlock as a second barrier.&lt;/strong> &lt;code>bubblewrap&lt;/code> isolates via &lt;em>namespaces and mounts&lt;/em>; Landlock, a Linux Security Module available since kernel 5.13, restricts access at the &lt;strong>VFS&lt;/strong> level, independently of namespaces. It does not replace &lt;code>bwrap&lt;/code>: it complements it. It closes vectors that mount-based isolation does not cover on its own (escape routes via &lt;code>/proc&lt;/code>, symlink tricks inside allowed mounts) and acts as a safety net should the namespace machinery have a bug. It is defence in depth inside the client itself, and it degrades cleanly to a no-op on kernels that do not support it.&lt;/p>
&lt;p>&lt;strong>Dev containers, when reproducibility is needed.&lt;/strong> A dev container (&lt;code>devcontainer.json&lt;/code>, what Codespaces and Cursor use) is a Docker container with a configuration layer on top. It gives reasonable filesystem isolation and easy &lt;em>reset&lt;/em> (destroy and recreate), but it &lt;strong>shares the host kernel&lt;/strong>, the same limitation as any Docker, and it tends to be long-lived, accumulating state. For an agent running your own team&amp;rsquo;s code on your own machine it is a good repeatability story; it is not, on its own, the isolation layer for untrusted code.&lt;/p>
&lt;p>&lt;strong>What wraps all of this.&lt;/strong> A hand-written bash script works, but it does not scale to a team. The tools that package it:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>&lt;code>ai-jail&lt;/code>&lt;/strong> (Rust, GPL-3.0): wraps &lt;code>bwrap&lt;/code>/&lt;code>sandbox-exec&lt;/code> with per-project config in a &lt;code>.ai-jail&lt;/code> file (TOML, committable to the repo, so the whole team inherits the same policy), auto-detection of GPU/Docker/display, a &lt;code>--lockdown&lt;/code> mode (project read-only, network cut with &lt;code>--unshare-net&lt;/code>, &lt;code>--clearenv&lt;/code>), &lt;code>--dry-run&lt;/code> for auditing, and &lt;code>--bootstrap&lt;/code> to generate each agent&amp;rsquo;s permission allowlists. It is tool-agnostic: the same binary serves Claude, Codex, OpenCode or Crush. It also applies Landlock automatically on 5.13+ kernels as defence in depth.&lt;/li>
&lt;li>&lt;strong>The Claude Code &lt;code>/sandbox&lt;/code>&lt;/strong>: since October 2025 Claude Code ships its own sandbox that uses, exactly, &lt;code>bubblewrap&lt;/code> on Linux and &lt;code>sandbox-exec&lt;/code> on macOS. Its &lt;em>Sandboxed Bash&lt;/em> isolates shell commands, but &lt;strong>not&lt;/strong> the file tools, the MCP servers or the hooks, which run with the process&amp;rsquo;s full permissions unless you enable the beta &lt;code>sandbox-runtime&lt;/code> package, which wraps the whole process. There is one nuance worth knowing: if a command fails because of a restriction, the agent can retry with &lt;code>dangerouslyDisableSandbox&lt;/code> — it is &lt;em>opt-out&lt;/em>, not &lt;em>opt-in&lt;/em>.&lt;/li>
&lt;li>&lt;strong>Codex CLI&lt;/strong>: three modes via &lt;code>--sandbox&lt;/code> (&lt;code>read-only&lt;/code>, &lt;code>workspace-write&lt;/code>, &lt;code>danger-full-access&lt;/code>); the recommended default is &lt;code>workspace-write&lt;/code>. The philosophy is deliberate: Codex does not provide the isolation, it delegates it to the environment that wraps it. &lt;code>danger-full-access&lt;/code> only makes sense &lt;strong>inside&lt;/strong> a microVM.&lt;/li>
&lt;li>&lt;strong>Cursor&lt;/strong>: its cloud agents run in isolated VMs; &lt;code>/worktree&lt;/code> creates a single-use isolated worktree per task, and &lt;code>/best-of-n&lt;/code> launches several attempts in parallel in separate worktrees.&lt;/li>
&lt;/ul>
&lt;h2 id="the-cluster-isolating-the-agent-in-production">The cluster: isolating the agent in production&lt;/h2>
&lt;p>The second building is the datacenter. Here the &amp;ldquo;agent&amp;rdquo; can be an autonomous agent running with no human in front of it, or the inference service itself executing generated code, or a multi-tenant workload where one customer&amp;rsquo;s pod must not touch another&amp;rsquo;s data. The process is no longer one: they are pods in a Kubernetes cluster (RKE2/RKE3 on a typical sovereign platform). The primitives change in nature.&lt;/p>
&lt;p>&lt;strong>The pod baseline.&lt;/strong> First of all, the standard kit: Linux namespaces, &lt;code>seccomp&lt;/code> (&lt;code>RuntimeDefault&lt;/code>) to trim the syscall surface, cgroups for resource limits, an unprivileged &lt;code>securityContext&lt;/code> (&lt;code>runAsNonRoot&lt;/code>, &lt;code>readOnlyRootFilesystem&lt;/code>, dropping all capabilities) and &lt;strong>NetworkPolicy&lt;/strong> to cut egress. It is the cluster equivalent of the process sandbox allowlist. Necessary, but it shares the kernel with the host: insufficient for genuinely untrusted code.&lt;/p>
&lt;p>&lt;strong>gVisor (&lt;code>runsc&lt;/code>).&lt;/strong> Google&amp;rsquo;s user-space kernel: it intercepts the workload&amp;rsquo;s syscalls before they reach the host kernel and serves them inside a Linux kernel reimplemented in Go (the &lt;em>Sentry&lt;/em>). The surface exposed to host kernel vulnerabilities drops sharply, while keeping fast startup and a low footprint. It is the middle ground when the risk of a kernel escape is real but the overhead of a microVM is not acceptable.&lt;/p>
&lt;p>&lt;strong>Firecracker / Kata microVMs.&lt;/strong> The de facto standard for untrusted code in 2026. Firecracker (AWS&amp;rsquo;s VMM written in Rust, on top of KVM) gives each sandbox a &lt;strong>dedicated Linux kernel&lt;/strong>: a kernel exploit inside the microVM does not reach the host &lt;em>by construction&lt;/em>. It is what sits underneath Vercel Sandbox (GA January 2026) and E2B. On Kubernetes, &lt;strong>Kata Containers&lt;/strong> brings that model to a &lt;code>RuntimeClass&lt;/code>: you mark the untrusted agent&amp;rsquo;s pod with &lt;code>runtimeClassName: kata&lt;/code> and it runs in its own microVM instead of sharing the node&amp;rsquo;s kernel. For multi-tenant with generated code, this is the baseline, not the luxury.&lt;/p>
&lt;p>&lt;strong>eBPF / Tetragon: the layer we already have.&lt;/strong> Here is the piece that separates a platform with runtime observability from one that only trusts its configuration. The previous layers are &lt;em>static&lt;/em>: they define what the pod can do before it starts. &lt;strong>Tetragon&lt;/strong>, Cilium&amp;rsquo;s runtime security component, based on eBPF, is &lt;em>dynamic&lt;/em>: it observes, in the kernel and at minimal cost, &lt;strong>every&lt;/strong> process execution, &lt;strong>every&lt;/strong> network connection and &lt;strong>every&lt;/strong> file open in every pod, and it can act inline. It does not replace the sandbox; it watches it from inside the kernel. Where &lt;code>bubblewrap&lt;/code> on the client blocks &lt;code>curl&lt;/code> with a command blocklist, Tetragon on the cluster hooks &lt;code>tcp_connect&lt;/code> in the kernel and, if the destination is not allowed, &lt;strong>kills the process with &lt;code>Sigkill&lt;/code>&lt;/strong> before the packet leaves. Where the client hides &lt;code>~/.ssh&lt;/code> behind a tmpfs, Tetragon hooks &lt;code>security_file_open&lt;/code> and reports, or kills, any attempt to read a sensitive mounted path. It is the guard patrolling the corridors while the microVMs are the walls. And it is exactly the kind of control that materialises the ENS monitoring and traceability measures (&lt;code>op.mon&lt;/code>, &lt;code>op.exp&lt;/code>) without instrumenting the application: visibility lives in the kernel, not in the agent&amp;rsquo;s code.&lt;/p>
&lt;h2 id="the-landscape-table">The landscape table&lt;/h2>
&lt;p>The five families, their relative isolation strength, their startup cost and the domain where they live:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Tier&lt;/th>
&lt;th>Primitive&lt;/th>
&lt;th style="text-align:center">Isolation&lt;/th>
&lt;th style="text-align:center">Startup&lt;/th>
&lt;th>Natural domain&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>Process sandbox&lt;/td>
&lt;td>Seatbelt · bubblewrap&lt;/td>
&lt;td style="text-align:center">Baseline&lt;/td>
&lt;td style="text-align:center">~0 ms&lt;/td>
&lt;td>&lt;strong>Client&lt;/strong> (Claude Code default)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Dev container&lt;/td>
&lt;td>Docker + seccomp&lt;/td>
&lt;td style="text-align:center">Moderate&lt;/td>
&lt;td style="text-align:center">seconds&lt;/td>
&lt;td>Client / cluster (repeatability)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>User-space kernel&lt;/td>
&lt;td>gVisor (&lt;code>runsc&lt;/code>)&lt;/td>
&lt;td style="text-align:center">Strong&lt;/td>
&lt;td style="text-align:center">ms&lt;/td>
&lt;td>&lt;strong>Cluster&lt;/strong> (medium multi-tenant)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>microVM&lt;/td>
&lt;td>Firecracker · Kata&lt;/td>
&lt;td style="text-align:center">Strongest (practical)&lt;/td>
&lt;td style="text-align:center">&amp;lt;1 s&lt;/td>
&lt;td>&lt;strong>Cluster&lt;/strong> (untrusted code)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Full VM&lt;/td>
&lt;td>KVM · EC2&lt;/td>
&lt;td style="text-align:center">Maximum&lt;/td>
&lt;td style="text-align:center">30 s+&lt;/td>
&lt;td>Cluster (external boundary, compliance)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;em>Runtime enforcement&lt;/em>&lt;/td>
&lt;td>&lt;strong>eBPF · Tetragon&lt;/strong>&lt;/td>
&lt;td style="text-align:center">&lt;em>Cross-cutting&lt;/em>&lt;/td>
&lt;td style="text-align:center">&lt;em>always on&lt;/em>&lt;/td>
&lt;td>&lt;strong>Cluster&lt;/strong> (watches+kills on top of any tier)&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>Tetragon gets its own row on purpose: it is not a rung on the ladder, it is a &lt;strong>cross-cutting layer&lt;/strong> that operates &lt;em>on top of&lt;/em> any of the others. It stacks with all of them.&lt;/p>
&lt;p>A numerical note on why the &amp;ldquo;startup&amp;rdquo; column decides as much as the &amp;ldquo;isolation&amp;rdquo; column. A full VM wins on raw isolation but takes tens of seconds to provision; for an agent that needs a fresh environment &lt;em>per request or per session&lt;/em>, that cost is prohibitive. A Firecracker microVM starts in &lt;strong>under 1 second&lt;/strong> and a process sandbox in &lt;strong>~0 ms&lt;/strong>. That is why the dominant pattern in 2026 is not &amp;ldquo;the most isolated VM&amp;rdquo;, but &lt;strong>a full VM as the external boundary plus a microVM as the per-request execution unit inside&lt;/strong>, the architecture of Vercel, AWS Lambda and E2B. On the client the arithmetic is the opposite: the developer launches the agent dozens of times a day interactively, and a startup measured in seconds would break the flow; hence the process sandbox, with its microsecond overhead, is the correct default.&lt;/p>
&lt;h2 id="extrapolate-do-not-copy">Extrapolate, do not copy&lt;/h2>
&lt;p>The thesis of this pair of posts fits in one sentence: &lt;strong>the threat model is invariant across domains; the primitive that implements it is not.&lt;/strong> The client and the cluster defend exactly the same five vectors — filesystem, network, kernel, multi-tenant, secrets — but with toolboxes that do not overlap. Every control has its twin on the other side:&lt;/p>
&lt;ul>
&lt;li>&lt;code>$HOME&lt;/code> as an ephemeral tmpfs (client) ↔ &lt;code>readOnlyRootFilesystem&lt;/code> + &lt;code>emptyDir&lt;/code> (cluster).&lt;/li>
&lt;li>A &lt;code>curl&lt;/code>/&lt;code>wget&lt;/code> blocklist in &lt;code>bwrap&lt;/code> (client) ↔ a &lt;code>TracingPolicy&lt;/code> on &lt;code>tcp_connect&lt;/code> in Tetragon plus NetworkPolicy (cluster).&lt;/li>
&lt;li>&lt;code>--unshare-net&lt;/code> in lockdown (client) ↔ default-deny NetworkPolicy (cluster).&lt;/li>
&lt;li>No &lt;em>escape hatch&lt;/em>, the process lives inside &lt;code>bwrap&lt;/code> (client) ↔ no &lt;code>privileged&lt;/code>, no &lt;code>hostPath&lt;/code>, &lt;code>RuntimeClass&lt;/code> kata (cluster).&lt;/li>
&lt;li>&lt;code>~/.ssh&lt;/code> and &lt;code>~/.aws&lt;/code> never mounted (client) ↔ secrets outside the pod plus Tetragon watching &lt;code>security_file_open&lt;/code> (cluster).&lt;/li>
&lt;/ul>
&lt;p>The sibling runbook turns each of these equivalences into concrete files. What matters here is the method: when someone shows you an agent sandbox, be it the Claude Code &lt;code>/sandbox&lt;/code> on a laptop or a microVM on a PaaS, the useful question is not &amp;ldquo;which tool does it use?&amp;rdquo;, but &amp;ldquo;which of the five vectors does it close, and which does it leave open?&amp;rdquo;. The tool gets replaced; the threat map stays.&lt;/p>
&lt;h2 id="what-no-sandbox-solves">What no sandbox solves&lt;/h2>
&lt;p>Three limits that Anthropic&amp;rsquo;s own documentation states, and which are worth keeping in view so as not to sell smoke:&lt;/p>
&lt;ol>
&lt;li>&lt;strong>Egress remains a risk&lt;/strong> in any sandbox that allows outbound connections. If the agent can open a connection, it can exfiltrate. That is why the client lockdown &lt;em>cuts&lt;/em> the network and the cluster uses default-deny NetworkPolicy plus Tetragon: you do not trust &amp;ldquo;filtering well&amp;rdquo;, you trust &amp;ldquo;not letting anything out&amp;rdquo;.&lt;/li>
&lt;li>&lt;strong>Code modification remains possible&lt;/strong> in any sandbox with the project directory mounted writable. The remedy is not a sandbox-technical one, it is &lt;strong>git&lt;/strong>: with the remote untouched and no &lt;code>push&lt;/code> permission, the worst case is corrupting the local working copy — &lt;code>git checkout .&lt;/code> and start again. The damage never reaches the remote.&lt;/li>
&lt;li>&lt;strong>No sandbox prevents a compromised prompt from reaching the API.&lt;/strong> Isolation bounds the impact of an injection; it does not prevent it. The complementary defences — input validation, tool-call allowlists, output auditing — are mandatory &lt;em>alongside&lt;/em> isolation, not instead of it.&lt;/li>
&lt;/ol>
&lt;p>The operational conclusion: &lt;strong>isolation shrinks the blast radius; defence in depth is what closes the circle.&lt;/strong> A process sandbox for trusted code on a known machine is appropriate and practically free. For an agent acting on user prompts, executing generated code or running multi-tenant, the acceptable minimum in 2026 is a microVM, with Tetragon watching from above. Pick the tier that matches your real threat, check which vector it leaves open, and stack complementary controls on top.&lt;/p>
&lt;h2 id="see-also">See also&lt;/h2>
&lt;ul>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/hardening-secrets-sovereign-llm-stack-defence-in-depth/">Hardening and secrets in the sovereign LLM stack: defence in depth&lt;/a> — the hardening of the stack that hosts those agents: network, secrets, runtime.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/runbook-caging-ai-agent-bubblewrap-tetragon/">Runbook: caging the AI agent — bubblewrap on the client, Tetragon on the cluster&lt;/a> — the operational companion to this post: the &lt;code>.ai-jail&lt;/code> files, the permissions &lt;code>--bootstrap&lt;/code> and the Tetragon &lt;code>TracingPolicy&lt;/code> files to copy and paste. With commands.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/network-numa-cilium-ebpf-dranet-fourth-leg-pinning/">The kitchen door the maître never checked: network NUMA, Cilium eBPF and DRANET&lt;/a> — the Cilium eBPF datapath Tetragon leans on in the cluster; the same kernel layer, a different use.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/llm-guardrails-safety-four-lines-of-defence/">Guardrails and safety in LLMs&lt;/a> — mitigation on the &lt;em>content&lt;/em> plane (what the model says and what is said to it); this post is mitigation on the &lt;em>execution&lt;/em> plane (what the agent&amp;rsquo;s process can do).&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/technical-controls-ens-iso-42001-eu-ai-act-cross-mapping/">Technical controls: ENS × ISO 42001 × EU AI Act&lt;/a> — the compliance framework that runtime isolation materialises: Tetragon as technical evidence for &lt;code>op.mon&lt;/code>/&lt;code>op.exp&lt;/code>.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/oss-catalogue-llmops-six-stages-tool-by-tool/">Catalogue of OSS tools for LLMOps&lt;/a> — where the runtime security layer fits in the complete open stack.&lt;/p>
&lt;/li>
&lt;/ul>
&lt;h2 id="references">References&lt;/h2>
&lt;ul>
&lt;li>bubblewrap: &lt;a href="https://github.com/containers/bubblewrap">https://github.com/containers/bubblewrap&lt;/a>&lt;/li>
&lt;li>Landlock LSM: &lt;a href="https://landlock.io">https://landlock.io&lt;/a> · &lt;a href="https://docs.rs/landlock">https://docs.rs/landlock&lt;/a>&lt;/li>
&lt;li>ai-jail (Fabio Akita): &lt;a href="https://github.com/akitaonrails/ai-jail">https://github.com/akitaonrails/ai-jail&lt;/a>&lt;/li>
&lt;li>gVisor: &lt;a href="https://gvisor.dev">https://gvisor.dev&lt;/a>&lt;/li>
&lt;li>Firecracker: &lt;a href="https://firecracker-microvm.github.io">https://firecracker-microvm.github.io&lt;/a>&lt;/li>
&lt;li>Kata Containers: &lt;a href="https://katacontainers.io">https://katacontainers.io&lt;/a>&lt;/li>
&lt;li>Tetragon (Cilium): &lt;a href="https://tetragon.io">https://tetragon.io&lt;/a>&lt;/li>
&lt;li>Vercel Sandbox — concepts: &lt;a href="https://vercel.com/docs/vercel-sandbox/concepts">https://vercel.com/docs/vercel-sandbox/concepts&lt;/a>&lt;/li>
&lt;li>E2B: &lt;a href="https://github.com/e2b-dev/E2B">https://github.com/e2b-dev/E2B&lt;/a>&lt;/li>
&lt;li>Claude Code sandboxing: &lt;a href="https://docs.claude.com/en/docs/claude-code">https://docs.claude.com/en/docs/claude-code&lt;/a>&lt;/li>
&lt;li>Codex CLI: &lt;a href="https://github.com/openai/codex">https://github.com/openai/codex&lt;/a>&lt;/li>
&lt;/ul></description></item><item><title>The kitchen door the maître d' never looked at: network NUMA, Cilium eBPF and DRANET, the fourth leg of pinning</title><link>https://blog.lo0.es/en/posts/network-numa-cilium-ebpf-dranet-fourth-leg-pinning/</link><pubDate>Sat, 06 Jun 2026 12:00:00 +0200</pubDate><guid>https://blog.lo0.es/en/posts/network-numa-cilium-ebpf-dranet-fourth-leg-pinning/</guid><description>&lt;blockquote>
&lt;p>Fourth instalment, a coda, of &amp;ldquo;under the engine&amp;rdquo;. The series closed with three legs of locality: the &lt;a href="https://blog.lo0.es/en/posts/nvlink-nvswitch-nccl-cable-every-token-crosses/">cable between GPUs&lt;/a>, the &lt;a href="https://blog.lo0.es/en/posts/numa-hugepages-cpu-isolation-gpu-waits-kernel/">host by hand&lt;/a> and the &lt;a href="https://blog.lo0.es/en/posts/cpu-memory-topology-manager-rke2/">declarative orchestration of the kubelet&lt;/a>. But the maître d&amp;rsquo; of the last post seated the group looking at CPU, memory and GPU, and never asked &lt;strong>which door the dishes come through&lt;/strong>. That door is the NIC. Here is the fourth leg.&lt;/p>
&lt;/blockquote>
&lt;h2 id="tldr">TL;DR&lt;/h2>
&lt;p>The &lt;a href="https://blog.lo0.es/en/posts/cpu-memory-topology-manager-rke2/">Topology Manager&lt;/a> admits a pod under &lt;code>single-numa-node&lt;/code> if its CPUs, its memory and its GPU fit on the &lt;strong>same&lt;/strong> NUMA node. The &lt;strong>NIC is not part of that count&lt;/strong>: the kubelet has no Hint Provider for the network card. On an inference node with the network at 200/400 Gb/s, the case of &lt;a href="https://blog.lo0.es/en/posts/disaggregated-serving-prefill-decode-specialised-pods/">disaggregated serving&lt;/a>, where the KV-cache travels over RDMA between the prefill pool and the decode pool, a NIC on the wrong socket makes &lt;strong>every packet cross the UPI/QPI&lt;/strong>, exactly the &amp;ldquo;remote NUMA&amp;rdquo; the series fights on the compute side, but coming in through the network door. And there is a second front: the &lt;strong>softirq&lt;/strong> (&lt;code>NET_RX&lt;/code>) that processes the datapath runs on the CPU that services the NIC&amp;rsquo;s IRQ; if that CPU is one of the cores &lt;code>isolcpus&lt;/code>/&lt;code>reserved-cpus&lt;/code> gave exclusively to vLLM, the softirq steals cycles from it and injects jitter into the p99 tail. &lt;strong>Cilium eBPF&lt;/strong> replaces two RKE2 pieces, &lt;code>kube-proxy&lt;/code> (with eBPF/XDP load balancing) and the default CNI &lt;strong>Canal&lt;/strong> (with a native datapath), and its own tuning guide tells you to &lt;strong>kill &lt;code>irqbalance&lt;/code> and pin the NIC IRQs&lt;/strong>: a &lt;strong>fourth list&lt;/strong> to align alongside &lt;code>isolcpus&lt;/code> and &lt;code>reserved-cpus&lt;/code>. The 2026 state of the art closes the gap from above: &lt;strong>netkit&lt;/strong> (kernel ≥6.8, zero namespace overhead), &lt;strong>BIG TCP&lt;/strong> (192k super-packets for 100Gb/s+), &lt;strong>host-routing&lt;/strong> (iptables bypass), and above all &lt;strong>DRA/DRANET&lt;/strong>, the network driver that finally co-schedules &lt;strong>NUMA-local GPU and NIC on the same PCIe root&lt;/strong>, enabling GPUDirect RDMA with &lt;strong>+59.6% bus bandwidth in &lt;code>all_gather&lt;/code> and +58.1% in &lt;code>all_reduce&lt;/code>&lt;/strong>. On a generic RKE2 cluster with 4×H100 SXM nodes.&lt;/p>
&lt;h2 id="where-you-are-the-network-plane-the-trilogy-did-not-open">Where you are: the network plane the trilogy did not open&lt;/h2>
&lt;div class="diagram" style="max-width:560px;margin:1.2rem auto;">
&lt;svg viewBox="0 0 560 340" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="The fourth leg: the network plane under the same NUMA as CPU, memory and GPU">
&lt;text x="280" y="24" text-anchor="middle" font-family="sans-serif" font-size="13" font-weight="700" fill="currentColor">The vertical stack · the fourth leg of locality&lt;/text>
&lt;rect x="120" y="40" width="320" height="38" rx="6" fill="#f4f4f4" stroke="#888" stroke-width="1.3"/>
&lt;text x="280" y="64" text-anchor="middle" font-family="sans-serif" font-size="12" fill="#333">Engine · vLLM pod (TP, batching, KV-cache)&lt;/text>
&lt;rect x="120" y="84" width="320" height="38" rx="6" fill="#eef3fb" stroke="#4a6fa5" stroke-width="1.4"/>
&lt;text x="280" y="108" text-anchor="middle" font-family="sans-serif" font-size="12" fill="#333">Orchestration · kubelet: CPU/Mem/Topology Mgr (post 3)&lt;/text>
&lt;rect x="120" y="128" width="320" height="58" rx="6" fill="#dceede" stroke="#3c8c54" stroke-width="3"/>
&lt;text x="280" y="152" text-anchor="middle" font-family="sans-serif" font-size="12.5" font-weight="700" fill="#1f5c34">YOU ARE HERE · network plane: Cilium eBPF + DRA/NIC&lt;/text>
&lt;text x="280" y="170" text-anchor="middle" font-family="sans-serif" font-size="10.5" fill="#2c6b42">NIC NUMA locality · IRQ · GPUDirect RDMA&lt;/text>
&lt;rect x="120" y="192" width="320" height="38" rx="6" fill="#f4f4f4" stroke="#888" stroke-width="1.3"/>
&lt;text x="280" y="216" text-anchor="middle" font-family="sans-serif" font-size="12" fill="#333">Host · NUMA, hugepages, isolcpus (post 2)&lt;/text>
&lt;rect x="120" y="236" width="320" height="38" rx="6" fill="#f4f4f4" stroke="#888" stroke-width="1.3"/>
&lt;text x="280" y="260" text-anchor="middle" font-family="sans-serif" font-size="12" fill="#333">CUDA + NCCL + NVLink (post 1)&lt;/text>
&lt;rect x="120" y="280" width="320" height="38" rx="6" fill="#f4f4f4" stroke="#888" stroke-width="1.3"/>
&lt;text x="280" y="304" text-anchor="middle" font-family="sans-serif" font-size="12" fill="#333">Hardware · 2 sockets, 4×H100 SXM, 400 Gb/s NIC&lt;/text>
&lt;text x="280" y="332" text-anchor="middle" font-family="sans-serif" font-size="10.5" font-style="italic" fill="#777">CPU+memory+GPU are pinned by the kubelet; the NIC, until 2026, was pinned by nobody&lt;/text>
&lt;/svg>
&lt;/div>
&lt;h2 id="the-analogy-the-door-the-dishes-come-through">The analogy: the door the dishes come through&lt;/h2>
&lt;p>Go back to the restaurant of the &lt;a href="https://blog.lo0.es/en/posts/cpu-memory-topology-manager-rke2/">previous post&lt;/a>. The maître d&amp;rsquo;, the Topology Manager, seated the party of eight at a single table (one NUMA node) because the diners (CPUs), the cutlery (memory) and the reserved bottle (the GPU) all fitted. A perfect table. But the maître d&amp;rsquo; &lt;strong>never looked at where the kitchen pass is&lt;/strong>: the door every dish comes in and goes out through.&lt;/p>
&lt;p>That door is the &lt;strong>NIC&lt;/strong>. The prompt comes in there, the tokens go out there, and, in disaggregated serving, the KV-cache that the prefill pool sends to the decode pool circulates there. If the table is in the left-hand room (socket 0) but the kitchen pass is in the right-hand one (socket 1), &lt;strong>every dish crosses the entire restaurant&lt;/strong> (the UPI/QPI), over and over, however impeccably the table is laid. The diner does not notice the perfect table: they notice the dish arriving late and cold.&lt;/p>
&lt;p>And there is a finer detail: the waiter who crosses the room with the dishes (the &lt;strong>softirq&lt;/strong> that processes the packets) is &lt;strong>one of the seated diners&lt;/strong>. If the maître d&amp;rsquo; gave them a chair of their own so they could eat in peace (a core isolated with &lt;code>isolcpus&lt;/code> for vLLM) but the restaurant also has them waiting on the far door, that diner does not eat: they spend the whole dinner crossing the room. The jitter shows up exactly where you thought you had bought calm.&lt;/p>
&lt;p>The trilogy levelled three legs of the table: the cable, the host and the orchestration. The fourth, &lt;strong>which door the dishes come through and who carries them&lt;/strong>, is levelled by no kubelet manager. Until 2026.&lt;/p>
&lt;h2 id="the-gap-why-the-topology-manager-does-not-look-at-the-nic">The gap: why the Topology Manager does not look at the NIC&lt;/h2>
&lt;p>The mechanism of &lt;a href="https://blog.lo0.es/en/posts/cpu-memory-topology-manager-rke2/">post 3&lt;/a> is a coordinator (Topology Manager) that consults three &lt;strong>Hint Providers&lt;/strong>: CPU Manager, Memory Manager and Device Manager (the GPU plugin). Each says on which NUMA node it can satisfy its part; the coordinator computes the intersection and admits or rejects.&lt;/p>
&lt;p>The problem is one of &lt;strong>census&lt;/strong>: the classic NIC is not a Device Manager &amp;ldquo;device&amp;rdquo;. A standard Ethernet/InfiniBand card is managed by the CNI and the kernel, it is not requested in the pod&amp;rsquo;s &lt;code>resources:&lt;/code> like &lt;code>nvidia.com/gpu&lt;/code>, and therefore &lt;strong>it emits no NUMA hint&lt;/strong>. The Topology Manager aligns CPU+memory+GPU and leaves the NIC wherever the hardware put it, which may be the other socket. The maître d&amp;rsquo; has three assistants and is missing the fourth: the one who knows which door the dishes come through.&lt;/p>
&lt;p>This did not matter when a node&amp;rsquo;s network was 10/25 Gb/s and the bottleneck was elsewhere. It matters &lt;strong>now&lt;/strong>, with two workloads that saturate the node&amp;rsquo;s network:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Disaggregated serving.&lt;/strong> The &lt;a href="https://blog.lo0.es/en/posts/disaggregated-serving-prefill-decode-specialised-pods/">KV-cache that travels between the prefill pool and the decode pool&lt;/a> moves over RDMA. These are large transfers, sensitive to latency and bandwidth, which in multi-node setups go out through the NIC.&lt;/li>
&lt;li>&lt;strong>Multi-node NCCL collectives.&lt;/strong> When &lt;a href="https://blog.lo0.es/en/posts/nvlink-nvswitch-nccl-cable-every-token-crosses/">tensor/pipeline parallelism crosses the node boundary&lt;/a>, the &lt;code>all-reduce&lt;/code>/&lt;code>all-gather&lt;/code> operations no longer go over NVLink but over GPUDirect RDMA on the NIC.&lt;/li>
&lt;/ul>
&lt;p>In both, &lt;strong>where the NIC sits relative to the GPU and to the pod&amp;rsquo;s cores&lt;/strong> decides performance. And the kubelet, on its own, does not coordinate that.&lt;/p>
&lt;h2 id="the-network-datapath-under-numa-irq-softirq-and-dma">The network datapath under NUMA: IRQ, softirq and DMA&lt;/h2>
&lt;p>To see why NIC locality carries weight, you have to look at the path of an incoming packet:&lt;/p>
&lt;div class="diagram" style="max-width:820px;margin:1.2rem auto;">
&lt;svg viewBox="0 0 820 320" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Path of a packet: NIC, IRQ, softirq and cross-NUMA DMA">
&lt;defs>&lt;marker id="nm" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto">&lt;path d="M0,0 L10,5 L0,10 z" fill="#666"/>&lt;/marker>&lt;/defs>
&lt;text x="410" y="22" text-anchor="middle" font-family="sans-serif" font-size="13" font-weight="700" fill="currentColor">Socket 0 (NIC here) vs Socket 1 (vLLM pod here): the crossing you do not see&lt;/text>
&lt;!-- Socket 0 -->
&lt;rect x="30" y="46" width="360" height="240" rx="10" fill="none" stroke="#4a6fa5" stroke-width="1.6" stroke-dasharray="5 3"/>
&lt;text x="210" y="66" text-anchor="middle" font-family="sans-serif" font-size="11" font-weight="700" fill="#4a6fa5">NUMA node 0 · PCIe root with the NIC&lt;/text>
&lt;rect x="60" y="80" width="120" height="44" rx="7" fill="#eef3fb" stroke="#4a6fa5" stroke-width="1.6"/>
&lt;text x="120" y="100" text-anchor="middle" font-family="sans-serif" font-size="11" font-weight="700" fill="#222">NIC 400 Gb/s&lt;/text>
&lt;text x="120" y="115" text-anchor="middle" font-family="sans-serif" font-size="9" fill="#444">multi-queue, RSS&lt;/text>
&lt;rect x="60" y="150" width="120" height="44" rx="7" fill="#f7efda" stroke="#c79a32" stroke-width="1.6"/>
&lt;text x="120" y="170" text-anchor="middle" font-family="sans-serif" font-size="11" font-weight="700" fill="#222">IRQ + softirq&lt;/text>
&lt;text x="120" y="185" text-anchor="middle" font-family="sans-serif" font-size="9" fill="#444">NET_RX on core 0..&lt;/text>
&lt;rect x="60" y="220" width="120" height="44" rx="7" fill="#dceede" stroke="#3c8c54" stroke-width="1.6"/>
&lt;text x="120" y="240" text-anchor="middle" font-family="sans-serif" font-size="11" font-weight="700" fill="#222">RAM node 0&lt;/text>
&lt;text x="120" y="255" text-anchor="middle" font-family="sans-serif" font-size="9" fill="#444">packet DMA&lt;/text>
&lt;path d="M120,124 L120,150" fill="none" stroke="#666" stroke-width="1.4" marker-end="url(#nm)"/>
&lt;path d="M120,194 L120,220" fill="none" stroke="#666" stroke-width="1.4" marker-end="url(#nm)"/>
&lt;!-- Socket 1 -->
&lt;rect x="430" y="46" width="360" height="240" rx="10" fill="none" stroke="#a85454" stroke-width="1.6" stroke-dasharray="5 3"/>
&lt;text x="610" y="66" text-anchor="middle" font-family="sans-serif" font-size="11" font-weight="700" fill="#a85454">NUMA node 1 · the kubelet pinned the pod here&lt;/text>
&lt;rect x="550" y="150" width="160" height="44" rx="7" fill="#dceede" stroke="#3c8c54" stroke-width="2.2"/>
&lt;text x="630" y="170" text-anchor="middle" font-family="sans-serif" font-size="11" font-weight="700" fill="#222">vLLM pod + GPU&lt;/text>
&lt;text x="630" y="185" text-anchor="middle" font-family="sans-serif" font-size="9" fill="#444">exclusive CPUs node 1&lt;/text>
&lt;!-- cross-numa arrow -->
&lt;path d="M180,242 C320,242 470,172 550,172" fill="none" stroke="#a85454" stroke-width="2.4" marker-end="url(#nm)"/>
&lt;text x="370" y="225" text-anchor="middle" font-family="sans-serif" font-size="11" font-weight="700" fill="#a85454">every packet crosses the UPI/QPI&lt;/text>
&lt;text x="370" y="240" text-anchor="middle" font-family="sans-serif" font-size="9" font-style="italic" fill="#a85454">+latency, +load on the inter-socket link&lt;/text>
&lt;text x="410" y="306" text-anchor="middle" font-family="sans-serif" font-size="10" font-style="italic" fill="#777">The Topology Manager did its job on node 1; the NIC stayed on node 0. Nobody aligned the two.&lt;/text>
&lt;/svg>
&lt;/div>
&lt;p>Three kernel facts the analogy compresses:&lt;/p>
&lt;ol>
&lt;li>&lt;strong>The IRQ has affinity.&lt;/strong> Each NIC queue raises an interrupt that the kernel services on a specific CPU (&lt;code>/proc/irq/&amp;lt;n&amp;gt;/smp_affinity&lt;/code>). The heavy processing is deferred to a &lt;strong>softirq&lt;/strong> (&lt;code>NET_RX&lt;/code>/&lt;code>NET_TX&lt;/code>), which runs on &lt;strong>that same CPU&lt;/strong>. If &lt;code>irqbalance&lt;/code> is left loose, it migrates them non-deterministically, poison for the p99.&lt;/li>
&lt;li>&lt;strong>The softirq competes with the pod.&lt;/strong> If the IRQ lands on a core that &lt;code>isolcpus&lt;/code> reserved for vLLM, that queue&amp;rsquo;s &lt;code>NET_RX&lt;/code> steals cycles from the model. The signal in &lt;code>/proc/softirqs&lt;/code>: a &lt;code>NET_RX&lt;/code> column that spikes on a single CPU. It is the same jitter from &lt;a href="https://blog.lo0.es/en/posts/numa-hugepages-cpu-isolation-gpu-waits-kernel/">post 2&lt;/a>, coming in through the network.&lt;/li>
&lt;li>&lt;strong>DMA has a NUMA origin.&lt;/strong> The NIC writes the packet by DMA into the RAM of the socket of its PCIe root. If the consumer (the pod&amp;rsquo;s thread) is on the other socket, it reads across the UPI/QPI. RFS (Receive Flow Steering) tries to bring the processing to the consumer&amp;rsquo;s CPU, but it cannot teleport the NIC to the other socket.&lt;/li>
&lt;/ol>
&lt;h3 id="one-number-with-its-caveat">One number, with its caveat&lt;/h3>
&lt;p>Take a 2-socket node, a &lt;strong>400 Gb/s = 50 GB/s&lt;/strong> NIC on the PCIe root of socket 0, and a decode pod pinned to socket 1. If the NIC saturates, those ~50 GB/s of receive traffic &lt;strong>cross the UPI&lt;/strong> towards socket 1. A UPI 2.0 link runs at around &lt;strong>20–40 GB/s&lt;/strong> per direction and link depending on generation; even with several links, 50 GB/s of network traffic &lt;strong>going against the grain&lt;/strong> eats a far from negligible fraction of the inter-socket budget, the same budget already contended by the pod&amp;rsquo;s remote memory accesses and, if there is multi-node traffic, the &lt;a href="https://blog.lo0.es/en/posts/disaggregated-serving-prefill-decode-specialised-pods/">KV-cache of the disaggregation&lt;/a>. I am not giving a firm &amp;ldquo;X% degradation&amp;rdquo; because it depends on CPU generation, number of UPI links, MTU and traffic pattern; without that methodology, any exact figure is marketing.&lt;/p>
&lt;p>What &lt;strong>is&lt;/strong> measured with public methodology is the aggregate effect of aligning GPU and NIC: the &lt;strong>DRANET&lt;/strong> project reports &lt;strong>+59.6% bus bandwidth in &lt;code>all_gather&lt;/code> and +58.1% in &lt;code>all_reduce&lt;/code>&lt;/strong> (NCCL collectives) when the assigned NIC is &lt;strong>NUMA-local to the GPU&lt;/strong> rather than not. That is the size of the gap the Topology Manager was leaving open.&lt;/p>
&lt;h2 id="what-rke2s-cilium-ebpf-replaces-and-why-it-touches-this-story">What RKE2&amp;rsquo;s Cilium eBPF replaces (and why it touches this story)&lt;/h2>
&lt;p>RKE2 ships &lt;strong>Canal&lt;/strong> (Flannel + Calico) by default as the CNI and &lt;strong>&lt;code>kube-proxy&lt;/code>&lt;/strong> (iptables/IPVS rules) for Service balancing. Switching to Cilium (&lt;code>cni: cilium&lt;/code> in &lt;code>/etc/rancher/rke2/config.yaml&lt;/code>) replaces both pieces with an eBPF datapath:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>RKE2 piece&lt;/th>
&lt;th>What it does&lt;/th>
&lt;th>What Cilium eBPF puts in&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;code>kube-proxy&lt;/code> (iptables/IPVS)&lt;/td>
&lt;td>Service balancing&lt;/td>
&lt;td>LB in eBPF; with &lt;code>kubeProxyReplacement=true&lt;/code>, and acceleration in &lt;strong>XDP&lt;/strong> (driver layer)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Canal (Flannel+Calico)&lt;/td>
&lt;td>VXLAN overlay + NetworkPolicy&lt;/td>
&lt;td>native datapath (&lt;code>routingMode=native&lt;/code>), L3/L4 and L7 NetworkPolicy in eBPF&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>veth per pod&lt;/td>
&lt;td>namespace interface pair&lt;/td>
&lt;td>&lt;strong>netkit&lt;/strong> (kernel ≥6.8): namespace overhead ~0&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>host iptables traversal&lt;/td>
&lt;td>netfilter hooks&lt;/td>
&lt;td>eBPF &lt;strong>host-routing&lt;/strong>: bypasses iptables and the upper part of the stack&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>Up to here this is pure networking and it &lt;strong>does not touch&lt;/strong> the kubelet&amp;rsquo;s resource managers: Cilium does not assign exclusive CPUs nor emit compute NUMA hints. The ten knobs of &lt;a href="https://blog.lo0.es/en/posts/cpu-memory-topology-manager-rke2/">post 3&lt;/a> stay identical whether you run Canal or Cilium.&lt;/p>
&lt;p>&lt;strong>But&lt;/strong> Cilium does enter the fourth leg through two doors. The first: its own &lt;a href="https://docs.cilium.io/en/stable/operations/performance/tuning/">tuning guide&lt;/a> recommends, literally, &lt;em>&amp;ldquo;kill &lt;code>irqbalance&lt;/code> and pin the NIC IRQs to specific CPUs for maximum workload isolation&amp;rdquo;&lt;/em>, along with the &lt;code>tuned network-latency&lt;/code> profile, the &lt;code>performance&lt;/code> governor and &lt;code>CONFIG_PREEMPT_NONE&lt;/code>. In other words: the eBPF datapath only really performs &lt;strong>if you coordinate IRQ affinity&lt;/strong>, and that affinity has to point at the &lt;strong>housekeeping&lt;/strong> cores (&lt;code>reserved-cpus&lt;/code>), never at the isolated ones. So a &lt;strong>fourth list&lt;/strong> appears that must be kept consistent with &lt;code>isolcpus&lt;/code> and &lt;code>reserved-cpus&lt;/code>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-text" data-lang="text">&lt;span class="line">&lt;span class="cl">isolcpus = 2-31,34-63 # cores exclusive to vLLM (host, post 2)
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">reserved-cpus = 0-1,32-33 # kubelet housekeeping (post 3)
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">IRQ affinity = 0-1,32-33 # NIC IRQs → housekeeping ONLY (this post)
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> # never 2-31: there the softirq would steal from the model
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The second door: &lt;strong>netkit + host-routing + BIG TCP&lt;/strong> reduce how many times the packet crosses the stack and the namespace, which &lt;strong>cushions&lt;/strong> (does not eliminate) the cost of the NUMA crossing. BIG TCP assembles super-packets of up to 192k (against 64k) for 100Gb/s+; fewer stack traversals means less softirq work on the core, and therefore less pressure on the inter-socket budget. It is the &lt;a href="https://blog.lo0.es/en/posts/continuous-batching-orca-vllm-chunked-prefill-goodput/">continuous batching&lt;/a> analogy applied to the network stack: amortising a fixed cost over larger batches.&lt;/p>
&lt;h3 id="cilium-performance-profile-state-119-kernel-68">Cilium performance profile (state 1.19, kernel ≥6.8)&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Helm, recommended performance profile (summary of the tuning guide)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">helm install cilium cilium/cilium --version 1.19.4 &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --namespace kube-system &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --set &lt;span class="nv">routingMode&lt;/span>&lt;span class="o">=&lt;/span>native &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --set bpf.datapathMode&lt;span class="o">=&lt;/span>netkit &lt;span class="se">\ &lt;/span> &lt;span class="c1"># namespace overhead ~0 (kernel &amp;gt;=6.8)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> --set bpf.masquerade&lt;span class="o">=&lt;/span>&lt;span class="nb">true&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --set &lt;span class="nv">kubeProxyReplacement&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="nb">true&lt;/span> &lt;span class="se">\ &lt;/span> &lt;span class="c1"># replaces RKE2&amp;#39;s kube-proxy&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> --set &lt;span class="nv">enableIPv4BIGTCP&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="nb">true&lt;/span> &lt;span class="se">\ &lt;/span> &lt;span class="c1"># 192k super-packets (mlx5/ice NIC)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> --set &lt;span class="nv">enableIPv6BIGTCP&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="nb">true&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --set bpf.distributedLRU.enabled&lt;span class="o">=&lt;/span>&lt;span class="nb">true&lt;/span> &lt;span class="se">\#&lt;/span> per-CPU BPF maps: less spinlock contention
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> --set bpf.mapDynamicSizeRatio&lt;span class="o">=&lt;/span>0.08 &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --set &lt;span class="nv">bpfClockProbe&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="nb">true&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Verification inside a Cilium pod:&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">cilium status --verbose &lt;span class="p">|&lt;/span> grep -E &lt;span class="s2">&amp;#34;Device Mode|Host Routing|BIG TCP|XDP&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Device Mode: netkit · Host Routing: BPF · IPv4 BIG TCP: enabled · XDP Acceleration: Native&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Sceptical caveat: netkit and BIG TCP are &lt;strong>beta&lt;/strong> and require kernel ≥6.8 and specific NICs (mlx4/mlx5/ice). They are not in-place: they change datapath fundamentals and force you to restart pods or, better, to apply them by &lt;em>per-node config&lt;/em> only on new nodes. For an ENS cluster in production, that is a maintenance window, not a blind &lt;code>helm upgrade&lt;/code>.&lt;/p>
&lt;h2 id="the-2026-state-of-the-art-dra-and-dranet-the-maître-d-who-finally-looks-at-the-door">The 2026 state of the art: DRA and DRANET, the maître d&amp;rsquo; who finally looks at the door&lt;/h2>
&lt;p>What closes the gap at the root is not Cilium, it is the &lt;strong>admission mechanism&lt;/strong> the kubelet did not have for the NIC: &lt;strong>Dynamic Resource Allocation (DRA)&lt;/strong>, beta since Kubernetes 1.32 and with advances in every release up to 1.36 (May 2026). DRA generalises the &amp;ldquo;devices&amp;rdquo; model beyond the GPU: a driver discovers the hardware, publishes &lt;code>ResourceSlices&lt;/code> with its attributes, including the &lt;strong>NUMA topology and the PCIe root&lt;/strong>, and the scheduler resolves &lt;code>ResourceClaims&lt;/code> that can demand affinity between devices.&lt;/p>
&lt;p>&lt;strong>DRANET&lt;/strong> (a &lt;code>kubernetes-sigs&lt;/code> project) is the network DRA driver. It discovers the NICs (including the RDMA-capable ones), advertises them as &lt;code>ResourceSlices&lt;/code>, and via &lt;strong>NRI&lt;/strong> injects them into the pod&amp;rsquo;s namespace, compatible with whatever CNI you already have, Cilium included. The key piece for this story: combined with the &lt;strong>NVIDIA GPU DRA driver&lt;/strong>, it allows &lt;strong>co-scheduling GPU and NIC that share a PCIe root&lt;/strong> (the relationship NVIDIA calls &lt;code>NODE&lt;/code>), which is exactly the condition for &lt;strong>GPUDirect RDMA&lt;/strong>. The maître d&amp;rsquo; finally has a fourth assistant: &lt;em>&amp;ldquo;is there a NIC NUMA-local to this GPU?&amp;rdquo;&lt;/em>.&lt;/p>
&lt;p>The &lt;code>ResourceClaimTemplate&lt;/code> uses CEL selectors to request exactly that alignment:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-yaml" data-lang="yaml">&lt;span class="line">&lt;span class="cl">&lt;span class="c"># Request an RDMA NIC NUMA-local to the assigned GPU (illustrative DRANET/DRA schema)&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">apiVersion&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">resource.k8s.io/v1beta1&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">kind&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">ResourceClaimTemplate&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">metadata&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">gpu-nic-numa-aligned&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">spec&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">spec&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">devices&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">requests&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">rdma-nic&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">deviceClassName&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">dra.net &lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c"># NICs published by DRANET&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">constraints&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">requests&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;rdma-nic&amp;#34;&lt;/span>&lt;span class="p">]&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">matchAttribute&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;dra.net/pcieRoot&amp;#34;&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c"># same PCIe root as the GPU&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="c"># → enables GPUDirect RDMA over a NUMA-local path&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Why it matters for inference, not for abstract &amp;ldquo;AI training&amp;rdquo;: in &lt;a href="https://blog.lo0.es/en/posts/disaggregated-serving-prefill-decode-specialised-pods/">disaggregated serving&lt;/a>, RDMA is what moves the KV-cache between the prefill pool and the decode pool with the latency that &lt;a href="https://blog.lo0.es/en/posts/optimising-prefill-vllm-knobs-ttft-will-not-forgive/">TTFT&lt;/a> demands; and in multi-node, GPUDirect RDMA replaces &lt;a href="https://blog.lo0.es/en/posts/nvlink-nvswitch-nccl-cable-every-token-crosses/">NVLink&lt;/a> as the medium of the collective. Aligning GPU+NIC on the same PCIe root is what turns an &amp;ldquo;RDMA that works&amp;rdquo; into an &amp;ldquo;RDMA that performs&amp;rdquo;, the +60% bus bandwidth from DRANET.&lt;/p>
&lt;p>Status and caveats: DRA is &lt;strong>beta&lt;/strong> (gates to enable by hand), DRANET is young (a SIG project, still evolving) and the managed offering exists mostly in cloud (GKE managed DRANET in preview, AKS for RDMA). For on-premise ENS it is a &lt;strong>path, not a finished product&lt;/strong>: the value today is understanding that the fourth leg already has a standard OSS mechanism, and starting to pilot it on a lab node, not putting it into critical production this quarter.&lt;/p>
&lt;h2 id="how-it-connects-with-the-rest-of-the-stack">How it connects with the rest of the stack&lt;/h2>
&lt;p>&lt;strong>With the host (post 2).&lt;/strong> The NIC&amp;rsquo;s IRQ affinity is a &lt;strong>third list&lt;/strong> to marry with &lt;code>isolcpus&lt;/code> and &lt;code>reserved-cpus&lt;/code>. The IRQs go to housekeeping; the isolated cores, untouched. Uncoordinating them lets in through the network door the jitter that &lt;code>isolcpus&lt;/code> threw out through the compute one.&lt;/p>
&lt;p>&lt;strong>With the orchestration (post 3).&lt;/strong> DRA is the natural extension of the Topology Manager: the same &amp;ldquo;admit only if it fits on the NUMA node&amp;rdquo; principle carried over to the NIC. Where the Device Manager left the network out of the census, DRANET puts it in.&lt;/p>
&lt;p>&lt;strong>With the interconnect (post 1).&lt;/strong> Inside the node NVLink rules; on crossing the node boundary, GPUDirect RDMA over the NIC is the medium of the collective. The kubelet&amp;rsquo;s NUMA policy guarantees that GPU and CPUs share a socket; &lt;strong>DRANET adds that the NIC does too&lt;/strong>, and only then does the RDMA take the short path.&lt;/p>
&lt;p>&lt;strong>With disaggregated serving.&lt;/strong> The prefill→decode KV-cache is the traffic that punishes a badly placed NIC hardest. The fourth leg is what stops &lt;a href="https://blog.lo0.es/en/posts/disaggregated-serving-prefill-decode-specialised-pods/">separating prefill and decode&lt;/a> from being paid for in transfer latency.&lt;/p>
&lt;p>&lt;strong>With capacity planning.&lt;/strong> &lt;a href="https://blog.lo0.es/en/posts/capacity-planning-on-premise-llm-inference/">Sizing&lt;/a> gains a dimension: &amp;ldquo;GPUs per node and cores per NUMA node&amp;rdquo; is not enough; you have to count &lt;strong>how many NICs NUMA-local to a GPU&lt;/strong> the chassis has. A node with 4 GPUs and a single NIC on socket 0 has two GPUs &amp;ldquo;far from the door&amp;rdquo;.&lt;/p>
&lt;p>&lt;strong>With observability.&lt;/strong> What confirms that the fourth leg is properly set is not an application dashboard: it is &lt;code>/proc/softirqs&lt;/code> (is &lt;code>NET_RX&lt;/code> concentrated on housekeeping?), &lt;code>nvidia-smi topo -m&lt;/code> (is the GPU↔NIC relationship &lt;code>NODE&lt;/code>/&lt;code>PHB&lt;/code>?) and the NIC counters. It fits with &lt;a href="https://blog.lo0.es/en/posts/gpu-observability-llm-inference-twelve-dcgm-vllm-metrics/">GPU observability with DCGM&lt;/a>: the GPU &amp;ldquo;at 60% for no reason&amp;rdquo; may be the host waiting for packets that cross the socket.&lt;/p>
&lt;h2 id="traps-and-things-that-are-not-what-they-look-like">Traps and things that are not what they look like&lt;/h2>
&lt;p>&lt;strong>Believing that switching to Cilium &amp;ldquo;already optimises the network&amp;rdquo;.&lt;/strong> Cilium eBPF replaces kube-proxy and Canal and performs better out of the box, but the default deployment prioritises compatibility, not performance. Without &lt;code>irqbalance&lt;/code> disabled, without IRQs pinned to housekeeping and without netkit/host-routing, you leave most of the improvement on the table. Cilium&amp;rsquo;s docs say so; plenty of people do not read the tuning guide.&lt;/p>
&lt;p>&lt;strong>Pinning the NIC IRQs to isolated cores.&lt;/strong> The symmetric mistake to knob 6 of post 3: if you set IRQ affinity over &lt;code>isolcpus&lt;/code>, the &lt;code>NET_RX&lt;/code> softirq steals cycles from vLLM on exactly the cores you isolated so nobody would disturb it. The IRQs go to &lt;code>reserved-cpus&lt;/code>, always.&lt;/p>
&lt;p>&lt;strong>Assuming the Topology Manager already aligns the NIC.&lt;/strong> It does not: the classic NIC is not a Hint Provider. If you need NIC↔GPU locality, today the mechanism is DRA/DRANET, not a kubelet policy. Waiting for &lt;code>single-numa-node&lt;/code> to solve it is waiting for something that is not in its design.&lt;/p>
&lt;p>&lt;strong>Putting DRA/DRANET into ENS production this quarter.&lt;/strong> It is beta and young. The sensible move is to pilot it on a lab node, measure &lt;code>all_reduce&lt;/code>/&lt;code>all_gather&lt;/code> with and without alignment, and decide with data. The +60% figure is from a specific environment; reproduce it in yours before promising it.&lt;/p>
&lt;p>&lt;strong>BIG TCP / netkit without reading the requirements.&lt;/strong> Kernel ≥6.8, mlx4/mlx5/ice NICs, no tunnel or encryption for BIG TCP, and nothing in-place: it forces pod restarts or per-node config. On a cluster with IPsec or with unsupported NICs, part of this does not apply. Check &lt;code>cilium status --verbose&lt;/code> before taking for granted that it is active.&lt;/p>
&lt;p>&lt;strong>Confusing the eBPF datapath (kernel) with the Cilium agent (pod).&lt;/strong> &lt;code>cilium-agent&lt;/code> is a &lt;code>Burstable&lt;/code> DaemonSet that should live on housekeeping (covered by &lt;code>system-reserved&lt;/code>). But datapath processing runs in &lt;strong>softirq&lt;/strong>, governed by the host&amp;rsquo;s IRQ affinity, &lt;strong>not&lt;/strong> by &lt;code>reserved-cpus&lt;/code>. They are two different things; pinning the pod well does not pin the softirq.&lt;/p>
&lt;h2 id="conclusion">Conclusion&lt;/h2>
&lt;p>The &amp;ldquo;under the engine&amp;rdquo; series chased one idea: performance that looks like an engine problem (vLLM is slow) or a model problem (quantisation) is, far too often, a &lt;strong>locality&lt;/strong> problem one layer down. The trilogy covered three: the cable (NVLink not used), the host (remote NUMA, jitter) and the orchestration (pinning that never happened). The fourth was miss&lt;strong>ing&lt;/strong>: &lt;strong>the network&lt;/strong>. The Topology Manager seats the pod at a perfect NUMA table and never asks which door the dishes come through nor who carries them. On a node at 25 Gb/s it made no difference; on one at 400 Gb/s with the KV-cache crossing over RDMA, that door decides TTFT and the collective&amp;rsquo;s bandwidth. &lt;strong>Cilium eBPF&lt;/strong> replaces kube-proxy and Canal with a datapath that performs, if you coordinate IRQ affinity with &lt;code>isolcpus&lt;/code>/&lt;code>reserved-cpus&lt;/code>, a fourth list to align, and &lt;strong>DRA/DRANET&lt;/strong> finally provides the census that was missing: co-scheduling NUMA-local GPU and NIC on the same PCIe root, with an improvement of a size (+60% NCCL bus bandwidth) that measures how big the gap was. Going down a level is not snobbery: it is that the root cause lived, once again, one layer below where the dashboard looks.&lt;/p>
&lt;h2 id="see-also">See also&lt;/h2>
&lt;ul>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/hardening-secrets-sovereign-llm-stack-defence-in-depth/">Hardening and secrets in the sovereign LLM stack: defence in depth&lt;/a> — the default-deny NetworkPolicies and mTLS with Cilium in the hardening of the stack.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/pcie-topology-gpudirect-p2p-acs-security-guard/">The corridors and the guard: PCIe, GPUDirect P2P and ACS&lt;/a> — the GPUDirect RDMA that DRANET places NUMA-locally is broken by ACS if it forces traffic through the root complex; the bus beneath NIC↔GPU locality.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/cpu-memory-topology-manager-rke2/">The maître d&amp;rsquo; who only seats you if you all fit at one table: resource managers on RKE2&lt;/a> — post 3, the direct parent of this one: the Topology Manager pins CPU+memory+GPU but not the NIC; here that fourth leg is opened.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/numa-hugepages-cpu-isolation-gpu-waits-kernel/">NUMA, hugepages and CPU isolation&lt;/a> — post 2; the NIC&amp;rsquo;s IRQ affinity is a third list to marry with &lt;code>isolcpus&lt;/code> and &lt;code>reserved-cpus&lt;/code>, and the &lt;code>NET_RX&lt;/code> softirq is the same jitter coming in through the network.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/nvlink-nvswitch-nccl-cable-every-token-crosses/">NVLink, NVSwitch and NCCL&lt;/a> — post 1; on crossing the node, GPUDirect RDMA over the NIC replaces NVLink, and DRANET is what guarantees that RDMA takes the NUMA-local path.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/disaggregated-serving-prefill-decode-specialised-pods/">Disaggregated serving: prefill and decode separated&lt;/a> — the case that punishes a badly placed NIC hardest: the prefill→decode KV-cache travels over RDMA and pays for every socket crossing.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/anatomy-on-premise-llm-inference-stack-seven-layers/">The on-premise LLM inference stack in seven layers&lt;/a> — the complete building; the network is the plane that holds up multi-node inference.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/llm-inference-autoscaling-kubernetes-hpa-keda/">Autoscaling LLMs on Kubernetes with KEDA&lt;/a> — every new replica does not only go through the kubelet&amp;rsquo;s NUMA admission; with DRA, also through the NIC &lt;code>ResourceClaim&lt;/code>&amp;rsquo;s.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/capacity-planning-on-premise-llm-inference/">Capacity planning for on-premise inference&lt;/a> — sizing gains a dimension: how many NICs NUMA-local to a GPU the chassis has, not just how many GPUs.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/mixed-nvidia-intel-environments-llm-inference/">Mixed NVIDIA + Intel environments&lt;/a> — NIC↔accelerator NUMA affinity gets complicated when the node mixes GPUs, accelerators and heterogeneous NICs.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/gpu-observability-llm-inference-twelve-dcgm-vllm-metrics/">GPU observability with DCGM&lt;/a> — how to confirm, metric in hand, that the &amp;ldquo;GPU at 60%&amp;rdquo; is not the host waiting for packets crossing the socket.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/pantry-lift-from-disk-to-hbm-why-the-kitchen-opens-late/">From disk to HBM: cold start and model loading&lt;/a> — the same &amp;ldquo;get the CPU out of the way&amp;rdquo; principle that GPUDirect RDMA gives here, applied to disk with GPUDirect Storage to load weights straight from NVMe to HBM.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/sms-cuda-streams-cuda-graphs-inference/">SM, CUDA streams and CUDA graphs&lt;/a> — one floor further down: once the data is in HBM, what happens in the silicon that executes it and why decode becomes launch-bound.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/isolating-ai-agents-workstation-to-cluster/">The contractor with the master key: isolating AI agents from the workstation to the cluster&lt;/a> — the other use of this same kernel layer: on top of Cilium&amp;rsquo;s eBPF datapath, Tetragon hooks its kprobes to observe and kill what an AI agent does in the cluster. Its &lt;a href="https://blog.lo0.es/en/posts/runbook-caging-ai-agent-bubblewrap-tetragon/">runbook&lt;/a> brings the concrete &lt;code>TracingPolicy&lt;/code> objects.&lt;/p>
&lt;/li>
&lt;/ul>
&lt;h2 id="references">References&lt;/h2>
&lt;ul>
&lt;li>Cilium, &lt;em>Tuning Guide&lt;/em> (netkit, host-routing, BIG TCP, XDP, pin the IRQs and kill irqbalance): &lt;a href="https://docs.cilium.io/en/stable/operations/performance/tuning/">https://docs.cilium.io/en/stable/operations/performance/tuning/&lt;/a>.&lt;/li>
&lt;li>Cilium 1.19 (February 2026), &lt;em>Cilium at Ten Years&lt;/em> — hardening of encryption, policies and observability: &lt;a href="https://www.infoq.com/news/2026/02/cilium-119/">https://www.infoq.com/news/2026/02/cilium-119/&lt;/a>.&lt;/li>
&lt;li>Isovalent, &lt;em>Cilium 1.18&lt;/em> (IPv6, encrypted overlay, ingress bandwidth, policy perf): &lt;a href="https://isovalent.com/blog/post/cilium-1-18/">https://isovalent.com/blog/post/cilium-1-18/&lt;/a>.&lt;/li>
&lt;li>RKE2, &lt;em>Network Options&lt;/em> (Canal by default; Cilium with kube-proxy replacement): &lt;a href="https://docs.rke2.io/networking/basic_network_options">https://docs.rke2.io/networking/basic_network_options&lt;/a>.&lt;/li>
&lt;li>Kubernetes, &lt;em>Dynamic Resource Allocation&lt;/em>: &lt;a href="https://kubernetes.io/docs/concepts/scheduling-eviction/dynamic-resource-allocation/">https://kubernetes.io/docs/concepts/scheduling-eviction/dynamic-resource-allocation/&lt;/a>.&lt;/li>
&lt;li>Kubernetes blog, &lt;em>v1.36: More Drivers, New Features, and the Next Era of DRA&lt;/em> (May 2026): &lt;a href="https://kubernetes.io/blog/2026/05/07/kubernetes-v1-36-dra-136-updates/">https://kubernetes.io/blog/2026/05/07/kubernetes-v1-36-dra-136-updates/&lt;/a>.&lt;/li>
&lt;li>DRANET (kubernetes-sigs), the network DRA driver and the paper &lt;em>The Kubernetes Network Driver Model&lt;/em> (+59.6% all_gather / +58.1% all_reduce): &lt;a href="https://github.com/kubernetes-sigs/dranet">https://github.com/kubernetes-sigs/dranet&lt;/a>.&lt;/li>
&lt;li>AKS Engineering, &lt;em>Optimizing RDMA performance for AI workloads on AKS with DRANET&lt;/em> (April 2026): &lt;a href="https://blog.aks.azure.com/2026/04/01/dranet-rdma-optimization-for-ai-on-aks">https://blog.aks.azure.com/2026/04/01/dranet-rdma-optimization-for-ai-on-aks&lt;/a>.&lt;/li>
&lt;li>Linux network tuning — IRQ affinity, RSS/RPS/RFS and NUMA softirq: &lt;a href="https://andreaskaris.github.io/blog/networking/rss-irq-affinity-and-rps/">https://andreaskaris.github.io/blog/networking/rss-irq-affinity-and-rps/&lt;/a>.&lt;/li>
&lt;/ul></description></item><item><title>eBPF in local inference and statistical drift detection: closing the LLM observability loop in 2026</title><link>https://blog.lo0.es/en/posts/ebpf-local-inference-statistical-drift-detection/</link><pubDate>Wed, 20 May 2026 09:00:00 +0200</pubDate><guid>https://blog.lo0.es/en/posts/ebpf-local-inference-statistical-drift-detection/</guid><description>&lt;h2 id="tldr">TL;DR&lt;/h2>
&lt;p>Tracing, evals, guardrails, MCP observability: the layers we have already covered see what is happening right now. What they do not see is what changes silently: the agent that answered well last week and this week, without anyone touching anything, answers slightly worse. What they also do not see is the fine mechanics of local inference: why a llama.cpp on an edge device takes 200 ms when it should take 100, which specific runtime function is the bottleneck. This post closes the two series of the week with the two layers that were missing: eBPF applied to local inference (uprobes on &lt;code>llama.cpp&lt;/code>, &lt;code>vLLM&lt;/code>, &lt;code>libcudart.so&lt;/code>, integrated hardware perf counters, with &amp;lt;4% overhead, formalised in the &lt;a href="https://arxiv.org/abs/2601.20755">ProfInfer 2026&lt;/a> paper, which is to local inference what Hubble is to the network) and statistical analysis of agent flows to detect drift before your user notices it (KS, PSI, MMD, embedding-space clustering, with &lt;a href="https://www.evidentlyai.com/">Evidently AI&lt;/a>, &lt;a href="https://www.nannyml.com/">NannyML&lt;/a> and &lt;a href="https://whylabs.ai/">WhyLabs&lt;/a> as the dominant tools). The three types of LLM drift in 2026, prompt drift, model drift and eval-score drift, demand different tests. The complete stack (tracing, evals, guardrails, MCP observability, eBPF observability, drift detection) forms the loop that any serious agentic system needs in order to operate with a real SLA rather than with hope.&lt;/p>
&lt;blockquote>
&lt;p>This post closes two series: the post-tracing series (&lt;a href="https://blog.lo0.es/en/posts/evals-llm-layer-after-tracing/">Evals&lt;/a>, &lt;a href="https://blog.lo0.es/en/posts/llm-guardrails-safety-four-lines-of-defence/">Guardrails&lt;/a>, &lt;a href="https://blog.lo0.es/en/posts/mcp-deep-observability-opentelemetry/">MCP observability&lt;/a>) and the eBPF series (&lt;a href="https://blog.lo0.es/en/posts/ebpf-zero-to-cilium-kernel-tcp-ip-bypass/">eBPF from zero to Cilium&lt;/a>, &lt;a href="https://blog.lo0.es/en/posts/tetragon-cilium-security-syscalls-kernel/">Tetragon&lt;/a>, &lt;a href="https://blog.lo0.es/en/posts/hubble-ebpf-network-observability-ai-agents/">Hubble&lt;/a>, &lt;a href="https://blog.lo0.es/en/posts/agentsight-llm-tracing-ebpf-zero-instrumentation/">AgentSight&lt;/a>). It brings the two threads together: eBPF applied to the local inference engine plus statistical analysis of the flows that every layer produces.&lt;/p>
&lt;/blockquote>
&lt;h2 id="the-analogy-the-agents-cardiogram">The analogy: the agent&amp;rsquo;s cardiogram&lt;/h2>
&lt;p>A doctor who only looks at acute symptoms, the patient arrives with a high fever and you have to act, is practising reactive medicine. To practise preventive medicine, they need time series: blood pressure every year, cholesterol every six months, an ECG when there is a suspicion. It is not &amp;ldquo;right now&amp;rdquo; information, it is information about how something that should be stable is evolving. When a time series deviates from its baseline, you investigate before it turns into a high fever.&lt;/p>
&lt;p>The LLM observability layers we have seen so far are reactive medicine: tracing tells you what happened in a specific conversation; evals tell you whether that conversation was good; guardrails tell you whether there was a specific threat; MCP observability tells you which tools were invoked and how. They all look at events, not trends.&lt;/p>
&lt;p>Drift detection is preventive medicine. It looks at time series, of prompt embeddings, of evaluation scores, of distributions of generated tokens, and fires alerts when something drifts away from its normality. It does not tell you &amp;ldquo;this answer is bad&amp;rdquo;; it tells you &amp;ldquo;the distribution of prompts over the last 6 hours does not look like the distribution of the last month&amp;rdquo;. There you decide whether to investigate.&lt;/p>
&lt;p>And the other half of the post, eBPF in local inference, is the equivalent of the MRI scanner: once you know there is a problem, it lets you see the inside of the model at a resolution no external wrapper gives you. To see which specific runtime function is slow, which CUDA kernel is the bottleneck, how tokens move through the internal buffers before going out to the client.&lt;/p>
&lt;p>The two together close the loop: the time series detect that something is wrong, the scanner locates where.&lt;/p>
&lt;h2 id="part-1--ebpf-applied-to-local-inference">Part 1 — eBPF applied to local inference&lt;/h2>
&lt;h3 id="why-local-inference-changes-the-game">Why local inference changes the game&lt;/h3>
&lt;p>When the LLM runs locally, vLLM on a Kubernetes node, llama.cpp on an edge device, Ollama on a workstation, MLX on macOS, and not behind an external API, observability changes shape:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>You control the binary&lt;/strong>: you can attach hooks that would otherwise be impossible.&lt;/li>
&lt;li>&lt;strong>The internal buffers exist in accessible RAM&lt;/strong>: the output-token stream, the logits, the KV caches, the scheduler structures are right there, at addresses a uprobe can read.&lt;/li>
&lt;li>&lt;strong>There is no cable to sniff&lt;/strong>: AgentSight&amp;rsquo;s analogy with SSL hooks does not apply because there is no TLS; the model answers you with an in-process function return, not with an HTTPS response.&lt;/li>
&lt;li>&lt;strong>The distance between kernel and model is minimal&lt;/strong>: the CUDA kernels running attention are one syscall deep; eBPF can observe both sides of that boundary with the same tracer.&lt;/li>
&lt;/ul>
&lt;p>This opens up a class of observability that is structurally impossible with LLM-as-a-service (the Anthropic, OpenAI or Vertex APIs). For apps serving inference on-premise or on-edge, an inference cluster, a mobile device, an RTX 4090 server in the rack, it is a new layer.&lt;/p>
&lt;h3 id="profinfer-the-paper-that-formalises-the-pattern">ProfInfer: the paper that formalises the pattern&lt;/h3>
&lt;p>&lt;a href="https://arxiv.org/abs/2601.20755">ProfInfer (arxiv 2601.20755, 2026)&lt;/a> is the reference academic piece that systematises what the ecosystem had been doing ad-hoc. The paper&amp;rsquo;s subtitle says it all: &lt;em>An eBPF-based Fine-Grained LLM Inference Profiler&lt;/em>.&lt;/p>
&lt;p>What it proposes:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Attaching uprobes dynamically&lt;/strong> to runtime functions of engines such as &lt;code>llama.cpp&lt;/code> (and by extension vLLM, Ollama). No recompiling, no modifying the source code. It is like &lt;code>bpftrace&lt;/code> for LLM inference.&lt;/li>
&lt;li>&lt;strong>Combining runtime events with hardware performance counters&lt;/strong>. A uprobe tells you when &lt;code>llama_decode&lt;/code> runs; a hardware counter tells you how many floating-point instructions executed while it was inside. The correlation between the two is what gives the fine resolution.&lt;/li>
&lt;li>&lt;strong>&amp;lt;4% measured overhead&lt;/strong> under real workloads. That is a production-grade cost.&lt;/li>
&lt;li>&lt;strong>Visualisations&lt;/strong> in three views: operators (which tensor operations ran), graphs (how they relate) and timelines (when).&lt;/li>
&lt;/ul>
&lt;p>The paper focuses particularly on models on mobile platforms (Llama served on a Pixel or an iPhone), where classic observability with Prometheus and exported metrics barely exists. But the pattern applies to any local inference.&lt;/p>
&lt;h3 id="where-to-hook-the-map-by-engine">Where to hook: the map by engine&lt;/h3>
&lt;p>Now to the detail of the hooks. The target functions vary by engine:&lt;/p>
&lt;h4 id="llamacpp">llama.cpp&lt;/h4>
&lt;p>&lt;code>llama.cpp&lt;/code> is pure C++, with symbols visible in the binary. The typical hooks:&lt;/p>
&lt;ul>
&lt;li>&lt;code>llama_decode&lt;/code>: the function that runs one inference pass (processes the current batch). Spans for latency per iteration, tokens processed.&lt;/li>
&lt;li>&lt;code>llama_token_to_piece&lt;/code>: converts a token ID to text. A hook here captures the stream of generated tokens before returning to the caller. It is the local equivalent of the SSL uprobes: you see the model&amp;rsquo;s output before it even reaches the consumer.&lt;/li>
&lt;li>&lt;code>llama_get_logits&lt;/code>: reads the logits of the last decode. If you want to record the model&amp;rsquo;s probabilities (not just the chosen token), here.&lt;/li>
&lt;li>&lt;code>ggml_compute_forward_*&lt;/code> (several functions): the operation kernels (matmul, attention, layernorm). Hooks for per-operation profiling.&lt;/li>
&lt;li>&lt;code>ggml_backend_*&lt;/code>: the backend functions (CPU, Metal, CUDA, ROCm). Hooks here break down the cost per device.&lt;/li>
&lt;/ul>
&lt;p>An example with &lt;code>bpftrace&lt;/code>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Latency and count of llama_decode&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">bpftrace -e &lt;span class="s1">&amp;#39;
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s1">uprobe:/path/to/llama-server:llama_decode {
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s1"> @start[tid] = nsecs;
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s1">}
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s1">uretprobe:/path/to/llama-server:llama_decode /@start[tid]/ {
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s1"> @decode_lat = hist((nsecs - @start[tid]) / 1000);
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s1"> delete(@start[tid]);
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s1">}
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s1">&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Output: a histogram of decode latencies in microseconds. Zero modification to the binary.&lt;/p>
&lt;h4 id="vllm">vLLM&lt;/h4>
&lt;p>vLLM is mostly Python. The C/CUDA symbols live in its native extensions (&lt;code>vllm._C&lt;/code>, &lt;code>vllm._moe_C&lt;/code>). The typical hooks:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>uprobes on &lt;code>vllm._C.*&lt;/code>&lt;/strong> for custom operators (the paged attention kernel, the sampling kernel).&lt;/li>
&lt;li>&lt;strong>uprobes on &lt;code>libcudart.so&lt;/code> and &lt;code>libcuda.so&lt;/code>&lt;/strong> to capture &lt;code>cudaMalloc&lt;/code>, &lt;code>cudaLaunchKernel&lt;/code>, &lt;code>cudaMemcpy&lt;/code>. This maps the cost of host↔device transfers and kernel launches.&lt;/li>
&lt;li>&lt;strong>Python tracepoints with &lt;code>bpftrace&lt;/code> over &lt;code>usdt&lt;/code> points&lt;/strong>: vLLM does not expose native static tracepoints, but they can be placed with USDT (&lt;code>dtrace&lt;/code> style) at strategic points in the scheduler.&lt;/li>
&lt;/ul>
&lt;p>vLLM also exposes native Prometheus metrics (&lt;code>vllm:num_requests_running&lt;/code>, &lt;code>vllm:gpu_cache_usage_perc&lt;/code>, and so on). The added value of the eBPF approach is going down from the scheduler&amp;rsquo;s metrics to the individual functions: when a request is slow, seeing whether it was prefill, decode, scheduler overhead, transfer or synchronisation.&lt;/p>
&lt;h4 id="cuda-in-general">CUDA in general&lt;/h4>
&lt;p>Independently of the engine, uprobes on &lt;code>libcudart.so&lt;/code> capture all the CUDA activity of the process:&lt;/p>
&lt;ul>
&lt;li>&lt;code>cudaMalloc(size)&lt;/code> → tracking of device memory allocations.&lt;/li>
&lt;li>&lt;code>cudaLaunchKernel(func, ...)&lt;/code> → spans for each kernel launch.&lt;/li>
&lt;li>&lt;code>cudaMemcpyAsync(dst, src, size, kind)&lt;/code> → host↔device transfers.&lt;/li>
&lt;li>&lt;code>cudaStreamSynchronize(stream)&lt;/code> → synchronisation points (where the host waits for the device).&lt;/li>
&lt;/ul>
&lt;p>This gives you a complete timeline of CUDA activity without needing NVIDIA Nsight Systems (which is excellent but heavy and oriented towards development, not continuous production).&lt;/p>
&lt;h3 id="hardware-counters-the-other-half">Hardware counters: the other half&lt;/h3>
&lt;p>eBPF can read performance counters from the CPU/GPU&amp;rsquo;s PMU (Performance Monitoring Unit). That includes instructions executed, cache misses, branch mispredictions and, on GPUs with support, FLOPS, SM occupancy, HBM bandwidth.&lt;/p>
&lt;p>Combining:&lt;/p>
&lt;ul>
&lt;li>uprobe: &amp;ldquo;&lt;code>llama_decode&lt;/code> ran from T1 to T2 with tokens=4&amp;rdquo;.&lt;/li>
&lt;li>perf counter: &amp;ldquo;during that window, L2 cache misses = 15,000, instructions = 2.3 million&amp;rdquo;.&lt;/li>
&lt;/ul>
&lt;p>This lets you answer: why is it slow? Is it memory-bound (many cache misses), compute-bound (all the instructions in the FPU), bandwidth-bound (a lot of data movement)? State of the art for professional profiling.&lt;/p>
&lt;h3 id="comparison-with-agentsight">Comparison with AgentSight&lt;/h3>
&lt;p>There are two eBPF products for LLMs today with different focuses:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>&lt;a href="https://blog.lo0.es/en/posts/agentsight-llm-tracing-ebpf-zero-instrumentation/">AgentSight&lt;/a>&lt;/strong> (covered in the eBPF series): observes agents that call external APIs. It hooks SSL to see the plaintext of HTTPS calls to the remote LLM, plus stdio for local MCP servers. The client view.&lt;/li>
&lt;li>&lt;strong>ProfInfer / the eBPF-on-local-inference pattern&lt;/strong>: observes the engine that runs the model locally. It hooks the engine&amp;rsquo;s internal functions (llama.cpp, vLLM) and the CUDA layer. The server (internal) view.&lt;/li>
&lt;/ul>
&lt;p>They are complementary. If your agent uses the Claude API plus your own local vLLM with Llama 3 for specific tasks, AgentSight sees the first, eBPF/ProfInfer sees the second. If everything is local, clearly the domain of the second. If everything is an external API, of the first.&lt;/p>
&lt;h3 id="use-cases-for-ebpf-in-local-inference">Use cases for eBPF in local inference&lt;/h3>
&lt;p>Three cases where it is the right tool:&lt;/p>
&lt;p>&lt;strong>Fine-grained profiling for optimisation&lt;/strong>: your vLLM takes 50ms more per token than expected. With eBPF plus hardware counters you pin down which specific kernel it is. Previously this required Nsight Systems in a development session; now it is continuous in production.&lt;/p>
&lt;p>&lt;strong>Token-level observability without modifying the engine&lt;/strong>: capturing the stream of generated tokens before returning them to the client. Useful for auditing, for drift detection over the outputs, for local tracing without going through wrapper instrumentation.&lt;/p>
&lt;p>&lt;strong>Detecting specific degradation&lt;/strong>: a new version of vLLM introduces a subtle regression in paged attention. With perf counter baselines, you detect the change even if the external metric (tokens/sec) looks the same.&lt;/p>
&lt;h2 id="part-2--statistical-analysis-of-flows-detecting-drift">Part 2 — Statistical analysis of flows: detecting drift&lt;/h2>
&lt;p>Now to the other side of the problem: the time series.&lt;/p>
&lt;h3 id="why-tracing-evals-and-guardrails-do-not-detect-drift">Why tracing, evals and guardrails do not detect drift&lt;/h3>
&lt;p>The layers we have already seen operate on individual events:&lt;/p>
&lt;ul>
&lt;li>Tracing: a trace of one conversation.&lt;/li>
&lt;li>Evals: a score for one answer.&lt;/li>
&lt;li>Guardrails: a verdict on one prompt or answer.&lt;/li>
&lt;li>MCP observability: spans of one tool invocation.&lt;/li>
&lt;/ul>
&lt;p>Each one answers a point-in-time question (&amp;ldquo;is this all right?&amp;rdquo;). None of them answers the question of evolution (&amp;ldquo;is something changing over time?&amp;rdquo;).&lt;/p>
&lt;p>The operational problem: drift is invisible in individual events. If the mean eval score drops from 0.92 to 0.85 over three weeks, no individual evaluation will raise an alarm, since they all continue to be &amp;ldquo;reasonable&amp;rdquo;. What changes is the distribution. And that only shows up when you look at many evaluations aggregated over time.&lt;/p>
&lt;h3 id="the-three-types-of-llm-drift-in-2026">The three types of LLM drift in 2026&lt;/h3>
&lt;p>&lt;a href="https://futureagi.com/blog/what-is-llm-drift-2026">FutureAGI&lt;/a> consolidates them like this, and the industry is converging on this vocabulary:&lt;/p>
&lt;p>&lt;strong>1. Prompt drift&lt;/strong>: someone updates the system prompt and the side effects break cases that used to work. Almost always intentional, but with unanticipated consequences. Detection: comparing response distributions before and after the change, monitoring eval scores per prompt version (linked in Langfuse, see the &lt;a href="https://blog.lo0.es/en/posts/agentsight-llm-tracing-ebpf-zero-instrumentation/">AgentSight&lt;/a> post where we covered prompt management).&lt;/p>
&lt;p>&lt;strong>2. Model drift&lt;/strong>: the provider (OpenAI, Anthropic) updates the model without warning. The same prompt produces answers with a slightly different tone, similar but different quality, or degradation on some subset. Detection: comparing today&amp;rsquo;s response embeddings with the baseline; monitoring rubric scores; alerting if intra-model variance grows.&lt;/p>
&lt;p>&lt;strong>3. Eval-score drift&lt;/strong>: the rolling mean of your eval metrics (faithfulness, answer relevancy, custom rubrics) trends downwards. The root cause can be any of the above or a change in the user mix. Detection: alerts on the trends of the eval series.&lt;/p>
&lt;p>To these three you can add a fourth, subtler one:&lt;/p>
&lt;p>&lt;strong>4. Persona drift / user mix shift&lt;/strong>: the population of users using the system changes. It is not that the model or the prompt got worse; it is that the new users ask different questions and the system, while still just as good at what it was good at, fails on the new material. Detection: embedding clustering of prompts, monitoring the appearance of new clusters or the growth of a minority one.&lt;/p>
&lt;h3 id="the-key-technical-concept-embedding-space-shift">The key technical concept: embedding-space shift&lt;/h3>
&lt;p>&lt;a href="https://stackpulsar.com/blog/llm-model-drift-detection/">Stack Pulsar&lt;/a> puts it plainly: in LLMs, drift is best measured in embedding space. Classic distances in token space do not capture fine semantics; in embedding space they do.&lt;/p>
&lt;p>The canonical pipeline:&lt;/p>
&lt;ol>
&lt;li>&lt;strong>Establish a baseline&lt;/strong>: during a stable period (say the first two weeks after a release), capture a large sample of prompt and response embeddings.&lt;/li>
&lt;li>&lt;strong>Continuous monitoring&lt;/strong>: every hour or every day, capture a new sample of production traffic.&lt;/li>
&lt;li>&lt;strong>Compare distributions&lt;/strong>: apply a statistical test that compares the current distribution with the baseline in embedding space.&lt;/li>
&lt;li>&lt;strong>Alert&lt;/strong>: if the divergence exceeds a threshold, fire an alert and an investigation workflow.&lt;/li>
&lt;/ol>
&lt;p>As a bonus, monitor clusters: if your baseline has 5 clusters of prompts (technical questions, general support, sales, and so on) and suddenly a sixth cluster appears that was not there, the most likely explanation is that a new user segment has arrived.&lt;/p>
&lt;h3 id="statistical-tests-ks-psi-mmd">Statistical tests: KS, PSI, MMD&lt;/h3>
&lt;p>Three tests that any drift system uses, each with its place:&lt;/p>
&lt;p>&lt;strong>Kolmogorov-Smirnov (KS)&lt;/strong>: non-parametric. It computes the maximum distance between two empirical CDFs. It returns a statistic and a p-value. Advantage: very sensitive to subtle changes, especially in the tails. Disadvantage: with large datasets it is &amp;ldquo;too sensitive&amp;rdquo;, firing alarms for changes that are real but clinically irrelevant.&lt;/p>
&lt;p>&lt;strong>Population Stability Index (PSI)&lt;/strong>: you bin the reference distribution and the current one, then sum &lt;code>(p_actual - p_ref) × log(p_actual / p_ref)&lt;/code> over the bins. The canonical interpretation: PSI &amp;lt; 0.1 stable, 0.1-0.25 mild drift, &amp;gt; 0.25 significant drift. Advantage: interpretable, threshold-based, with a tradition of use in credit scoring (Capital One, Goldman Sachs). Disadvantage: less sensitive than KS, so it misses drift in the tails.&lt;/p>
&lt;p>&lt;strong>Maximum Mean Discrepancy (MMD)&lt;/strong>: measures the divergence between two distributions by embedding each one in a Hilbert space via a kernel. It works for complex multivariate distributions (high-dimensional embeddings). Advantage: the only one that scales reasonably to embeddings of 768/1024/4096 dimensions. Disadvantage: harder to interpret.&lt;/p>
&lt;p>The recommended practice in 2026:&lt;/p>
&lt;ul>
&lt;li>PSI for simple features (prompt length, tokens, number of tools invoked).&lt;/li>
&lt;li>KS for continuous features where you want high sensitivity.&lt;/li>
&lt;li>MMD for embeddings (high-dimensional spaces).&lt;/li>
&lt;/ul>
&lt;p>&lt;a href="https://www.evidentlyai.com/blog/data-drift-detection-large-datasets">Evidently&amp;rsquo;s analysis&lt;/a> on real datasets showed that KS detects drift 6+ hours earlier than PSI in some incidents. The operational consequence: use KS for early warning, PSI for confirmation with an interpretable threshold.&lt;/p>
&lt;h3 id="tools-in-2026">Tools in 2026&lt;/h3>
&lt;p>Three products dominate the field:&lt;/p>
&lt;h4 id="evidently-ai">Evidently AI&lt;/h4>
&lt;p>&lt;a href="https://github.com/evidentlyai/evidently">Evidently&lt;/a> is open-source (Apache 2.0), Python-first. Its value:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>HTML drift reports&lt;/strong>: you generate a report comparing two datasets (reference vs current) and you get an HTML file with all the statistical tests, visualisations and conclusions. No server, no infrastructure; one shareable file.&lt;/li>
&lt;li>&lt;strong>Native LLM support&lt;/strong>: on top of tabular, it supports text. It computes embeddings and applies the appropriate tests.&lt;/li>
&lt;li>&lt;strong>100+ metrics&lt;/strong> in the suite. It covers everything from a single framework.&lt;/li>
&lt;li>&lt;strong>Integration with MLflow and kube&lt;/strong>: CI workflows with reports on every release.&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-python" data-lang="python">&lt;span class="line">&lt;span class="cl">&lt;span class="kn">from&lt;/span> &lt;span class="nn">evidently&lt;/span> &lt;span class="kn">import&lt;/span> &lt;span class="n">Report&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="kn">from&lt;/span> &lt;span class="nn">evidently.metrics&lt;/span> &lt;span class="kn">import&lt;/span> &lt;span class="n">DataDriftPreset&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">ref&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">load_baseline_dataset&lt;/span>&lt;span class="p">()&lt;/span> &lt;span class="c1"># prompts from last week&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">cur&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">load_current_dataset&lt;/span>&lt;span class="p">()&lt;/span> &lt;span class="c1"># prompts from the last hour&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">report&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">Report&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">metrics&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="n">DataDriftPreset&lt;/span>&lt;span class="p">()])&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">report&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">run&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">reference_data&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="n">ref&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">current_data&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="n">cur&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">report&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">save_html&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="s2">&amp;#34;drift_report.html&amp;#34;&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>When this functionality detects drift, it also tells you which column and which test fired.&lt;/p>
&lt;h4 id="nannyml">NannyML&lt;/h4>
&lt;p>&lt;a href="https://www.nannyml.com/">NannyML&lt;/a> has a different focus: estimating model performance when you have no ground truth. The techniques:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>CBPE (Confidence-Based Performance Estimation)&lt;/strong>: estimates accuracy using the model&amp;rsquo;s confidence in its predictions.&lt;/li>
&lt;li>&lt;strong>DLE (Direct Loss Estimation)&lt;/strong>: estimates the loss directly.&lt;/li>
&lt;/ul>
&lt;p>Useful when your LLM app has no immediate human feedback but you want to know whether its quality has dropped. Apache 2.0, Python.&lt;/p>
&lt;h4 id="whylabs">WhyLabs&lt;/h4>
&lt;p>&lt;a href="https://whylabs.ai/">WhyLabs&lt;/a> is commercial (with whylogs as the underlying OSS library), aimed at enterprise production:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Managed SaaS&lt;/strong> with SOC 2 Type 2 and HIPAA compliance.&lt;/li>
&lt;li>&lt;strong>Real-time monitoring&lt;/strong> via continuous log ingestion.&lt;/li>
&lt;li>&lt;strong>Embedding tracking&lt;/strong>: native support for embedding distributions, not just tabular features.&lt;/li>
&lt;li>&lt;strong>Token probability shifts&lt;/strong>: it monitors the probability distribution of generated tokens, not just metadata.&lt;/li>
&lt;/ul>
&lt;p>For regulated companies that do not want to operate their own drift detection platform, it is the lowest-friction option.&lt;/p>
&lt;h4 id="other-mentions">Other mentions&lt;/h4>
&lt;p>&lt;a href="https://phoenix.arize.com/">Arize Phoenix&lt;/a> (seen in the Evals post) includes drift detection as a module. &lt;a href="https://galileo.ai/">Galileo&lt;/a> has commercial products specialised in LLM monitoring. &lt;a href="https://www.fiddler.ai/">Fiddler AI&lt;/a> and &lt;a href="https://github.com/SeldonIO/alibi-detect">Alibi Detect&lt;/a> (Seldon) are more generalist alternatives that also cover LLMs.&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Tool&lt;/th>
&lt;th>Licence&lt;/th>
&lt;th>Focus&lt;/th>
&lt;th>Typical stack&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;strong>Evidently AI&lt;/strong>&lt;/td>
&lt;td>Apache 2.0&lt;/td>
&lt;td>Drift reports + LLM&lt;/td>
&lt;td>OSS Python, HTML reports&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>NannyML&lt;/strong>&lt;/td>
&lt;td>Apache 2.0&lt;/td>
&lt;td>Performance without GT&lt;/td>
&lt;td>OSS Python, batch&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>WhyLabs&lt;/strong>&lt;/td>
&lt;td>Commercial (whylogs OSS)&lt;/td>
&lt;td>Enterprise SaaS, embeddings&lt;/td>
&lt;td>Continuous logs, compliance&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Arize Phoenix&lt;/strong>&lt;/td>
&lt;td>ELv2&lt;/td>
&lt;td>Tracing + drift unified&lt;/td>
&lt;td>OSS, OTel-native&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Galileo&lt;/strong>&lt;/td>
&lt;td>Commercial&lt;/td>
&lt;td>Premium LLM monitoring&lt;/td>
&lt;td>SaaS, ML expert team&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Alibi Detect&lt;/strong>&lt;/td>
&lt;td>Apache 2.0&lt;/td>
&lt;td>General drift detection&lt;/td>
&lt;td>OSS Python, Seldon ecosystem&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Fiddler AI&lt;/strong>&lt;/td>
&lt;td>Commercial&lt;/td>
&lt;td>Explainability + monitoring&lt;/td>
&lt;td>Enterprise SaaS&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;h2 id="part-3--the-complete-stack-how-everything-fits">Part 3 — The complete stack: how everything fits&lt;/h2>
&lt;p>Let us recap the layers the two series have covered, ordered from closest to the individual request to closest to the aggregate trend:&lt;/p>
&lt;pre tabindex="0">&lt;code>Individual EVENTS Aggregated TRENDS
│ │
Tracing ──→ Evals ──→ Guardrails ──→ MCP obs ──→ Drift detection
│ │
AgentSight ──→ Tetragon ──→ Hubble ──→ eBPF on-device
│ │
(what happens) (what changes)
&lt;/code>&lt;/pre>&lt;p>Each layer answers a different question:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Layer&lt;/th>
&lt;th>Question it answers&lt;/th>
&lt;th>Granularity&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;strong>Tracing&lt;/strong> (Langfuse, AgentSight)&lt;/td>
&lt;td>What exactly did the agent do?&lt;/td>
&lt;td>One session&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Evals&lt;/strong>&lt;/td>
&lt;td>Was the answer good?&lt;/td>
&lt;td>One answer&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Guardrails&lt;/strong>&lt;/td>
&lt;td>Is this prompt/answer safe?&lt;/td>
&lt;td>One message&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>MCP observability&lt;/strong>&lt;/td>
&lt;td>Which tools did it invoke, at what cost?&lt;/td>
&lt;td>One tool call&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>eBPF on agent/network&lt;/strong> (AgentSight, Hubble)&lt;/td>
&lt;td>How did the system behave?&lt;/td>
&lt;td>Per process/connection&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>eBPF on the local engine&lt;/strong> (ProfInfer-like)&lt;/td>
&lt;td>How did the model execute?&lt;/td>
&lt;td>Per runtime function&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Drift detection&lt;/strong>&lt;/td>
&lt;td>Is something changing silently?&lt;/td>
&lt;td>Distribution&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>None of them replaces the others. Full coverage requires all seven. The practical operation:&lt;/p>
&lt;ol>
&lt;li>Layers 1-3 (tracing, evals, guardrails) are mandatory from day one. Any LLM app in production that does not have them is flying blind.&lt;/li>
&lt;li>Layer 4 (MCP) becomes mandatory when there are agents with tools, which is the majority in 2026.&lt;/li>
&lt;li>Layers 5-6 (eBPF) become valuable when the scale justifies the operating cost (&amp;gt;10 services, &amp;gt;100 inference pods).&lt;/li>
&lt;li>Layer 7 (drift) is the one that is most neglected and most expensive to ignore: it takes a day&amp;rsquo;s work to get the basic pipeline and it saves weeks of future incidents.&lt;/li>
&lt;/ol>
&lt;h2 id="the-operational-drift-pattern-in-2026">The operational drift pattern in 2026&lt;/h2>
&lt;p>The minimum recipe any serious LLM app should have:&lt;/p>
&lt;h3 id="step-1--establish-a-baseline">Step 1 — Establish a baseline&lt;/h3>
&lt;p>During a stable post-release period (2 weeks minimum), store:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Embeddings of every prompt&lt;/strong> (vector + metadata: timestamp, user_segment, tenant).&lt;/li>
&lt;li>&lt;strong>Embeddings of the responses&lt;/strong>.&lt;/li>
&lt;li>&lt;strong>Automated eval scores&lt;/strong> over a sample (e.g. 5-10% of traffic with G-Eval).&lt;/li>
&lt;li>&lt;strong>The distribution of tools invoked&lt;/strong> (which tools, with which typical arguments, at what frequency).&lt;/li>
&lt;/ul>
&lt;p>Storage: any vector store plus a relational one. Reasonable cardinality at whatever scale you have.&lt;/p>
&lt;h3 id="step-2--continuous-comparison-pipeline">Step 2 — Continuous comparison pipeline&lt;/h3>
&lt;p>Every hour (or every day depending on scale):&lt;/p>
&lt;ul>
&lt;li>Take the sample for the current period (the last hour).&lt;/li>
&lt;li>Apply the statistical tests against the baseline:
&lt;ul>
&lt;li>PSI over simple features (prompt length, tokens, num tools).&lt;/li>
&lt;li>KS over continuous features (latency, score).&lt;/li>
&lt;li>MMD over embeddings.&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>Generate a drift report (Evidently does it in one line of Python).&lt;/li>
&lt;/ul>
&lt;h3 id="step-3--alerts-and-investigation-workflow">Step 3 — Alerts and investigation workflow&lt;/h3>
&lt;p>Configure thresholds and routes:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>PSI &amp;gt; 0.25 over tokens consumed&lt;/strong>: moderate alert (it may be legitimate, investigate segments).&lt;/li>
&lt;li>&lt;strong>Significant MMD over prompt embeddings&lt;/strong>: high alert (a change in user mix or a coordinated attack).&lt;/li>
&lt;li>&lt;strong>Eval rubric score down &amp;gt;5% over a rolling 7d&lt;/strong>: critical alert.&lt;/li>
&lt;li>&lt;strong>A new cluster in embedding space accounting for 10%+ of traffic&lt;/strong>: a review workflow (it may be a legitimate new segment or an anomaly).&lt;/li>
&lt;/ul>
&lt;p>Every alert must lead to a drill-down dashboard with the affected segments, not to an empty Slack message. The operational rule: if someone cannot investigate the alert in &amp;lt;5 minutes, it will not get investigated.&lt;/p>
&lt;h3 id="step-4--baseline-refresh">Step 4 — Baseline refresh&lt;/h3>
&lt;p>The baseline is not static. Every N weeks, refresh the baseline by incorporating the &amp;ldquo;new stable&amp;rdquo;. If over 3 months the usage pattern has legitimately changed (more international users, new languages), the baseline must reflect it. The typical cadence: quarterly.&lt;/p>
&lt;h2 id="operational-traps">Operational traps&lt;/h2>
&lt;h3 id="a-contaminated-baseline">A contaminated baseline&lt;/h3>
&lt;p>You take the baseline from a period that already contained the problem in embryo. Result: the baseline includes the bad behaviour and the tests never fire. Solution: verify the baseline against a second independent sample (for example, the first week vs the second) before blessing it.&lt;/p>
&lt;h3 id="a-threshold-that-is-too-low">A threshold that is too low&lt;/h3>
&lt;p>PSI &amp;gt; 0.05 fires constantly. Your team learns to ignore the alerts. Calibrate thresholds against the natural noise of your system: run the system with the baseline plus successive weekly samples and measure the PSI distribution; set the threshold a couple of deviations above normal.&lt;/p>
&lt;h3 id="embeddings-that-are-not-representative">Embeddings that are not representative&lt;/h3>
&lt;p>You use OpenAI&amp;rsquo;s &lt;code>text-embedding-3-small&lt;/code> embedding model to detect drift in a system serving technical questions in Spanish about Cisco networks. Result: the embedding model does not capture the fine semantics of the domain. Solution: use embeddings finetuned for your domain, or one that is strong in multilingual and technical material.&lt;/p>
&lt;h3 id="storage-overload">Storage overload&lt;/h3>
&lt;p>Storing an embedding of every prompt in production at scale (millions of prompts/day) fills disks and increases cost. Stratified sampling: keep 5-10% of traffic, but make sure minority segments are over-represented so you do not lose them.&lt;/p>
&lt;h3 id="confusing-drift-with-the-system-works">Confusing drift with &amp;ldquo;the system works&amp;rdquo;&lt;/h3>
&lt;p>Sometimes drift is good drift: new users discover the agent knows how to do X, and suddenly 30% of traffic is for X. The distribution changed because the product found a new use. Before pulling the alarm, check whether the change is desirable.&lt;/p>
&lt;h3 id="privacy-in-embedding-storage">Privacy in embedding storage&lt;/h3>
&lt;p>Embeddings can be partially inverted back to their original text with embedding inversion techniques. If the prompts contain PII, storing embeddings for months for drift detection is a leak vector. Encrypt at rest and rotate regularly, or work with aggregated/averaged embeddings.&lt;/p>
&lt;h3 id="ebpf-in-production-without-profile-guardrails">eBPF in production without profile guardrails&lt;/h3>
&lt;p>Attaching uprobes to hot-path functions such as &lt;code>llama_decode&lt;/code> can hit throughput if it is not done carefully. Always test in staging and monitor the overhead. ProfInfer reports &amp;lt;4%; what you measure may vary with your binary and kernel.&lt;/p>
&lt;h2 id="closing-the-two-series">Closing the two series&lt;/h2>
&lt;p>This week we have written 12 articles that walk the modern LLM inference stack in production from top to bottom:&lt;/p>
&lt;p>&lt;strong>LLM inference series (4 articles)&lt;/strong>:&lt;/p>
&lt;ul>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/kv-cache-working-memory-llm-inference/">KV cache: the working memory that holds up LLM inference&lt;/a> — fundamentals.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/vllm-kubernetes-llm-inference-that-scales/">vLLM on Kubernetes&lt;/a> — the engine.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/pagedattention-vllm-block-manager/">PagedAttention deep dive&lt;/a> — how it works inside.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/llm-inference-operators-kubernetes/">LLM Operators on Kubernetes&lt;/a> — orchestration.&lt;/li>
&lt;/ul>
&lt;p>&lt;strong>eBPF series (4 articles)&lt;/strong>:&lt;/p>
&lt;ul>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/ebpf-zero-to-cilium-kernel-tcp-ip-bypass/">eBPF from zero to Cilium&lt;/a> — the substrate.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/tetragon-cilium-security-syscalls-kernel/">Tetragon&lt;/a> — runtime security.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/hubble-ebpf-network-observability-ai-agents/">Hubble&lt;/a> — network observability.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/agentsight-llm-tracing-ebpf-zero-instrumentation/">AgentSight&lt;/a> — agent observability.&lt;/li>
&lt;/ul>
&lt;p>&lt;strong>Post-tracing series (4 articles)&lt;/strong>:&lt;/p>
&lt;ul>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/evals-llm-layer-after-tracing/">Evals&lt;/a> — reactive quality.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/llm-guardrails-safety-four-lines-of-defence/">Guardrails&lt;/a> — preventive safety.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/mcp-deep-observability-opentelemetry/">MCP observability&lt;/a> — the tool protocol.&lt;/li>
&lt;li>This one — drift detection and eBPF in local inference.&lt;/li>
&lt;/ul>
&lt;p>If you read the twelve in order you have a reasonably complete map of what it takes to operate AI agents in serious production in 2026, with enough detail not to crash into the usual problems in the first month. And, above all, with the mindset that LLM observability is a stack, not a product: each layer solves a problem, none of them solves all of them, and the combination is what separates an operable system from one that holds up until the first incident.&lt;/p>
&lt;h2 id="what-is-left-for-future-series">What is left for future series&lt;/h2>
&lt;ul>
&lt;li>&lt;strong>MLOps specific to LLMs&lt;/strong>: continuous fine-tuning, RAG over data lakes, agent training.&lt;/li>
&lt;li>&lt;strong>Constitutional AI and alignment at runtime&lt;/strong>: how the model self-regulates with internal guardrails.&lt;/li>
&lt;li>&lt;strong>GPU networking&lt;/strong>: InfiniBand, NCCL, GPUDirect, the angle we left untouched.&lt;/li>
&lt;li>&lt;strong>Edge inference&lt;/strong>: llama.cpp on phones, MLX on macOS, Snapdragon NPU.&lt;/li>
&lt;li>&lt;strong>Theoretical inference scheduling&lt;/strong>: CFS-like algorithms applied to multi-tenant LLM serving.&lt;/li>
&lt;/ul>
&lt;p>We will cover them in time. That is it for now, and thanks for reading these twelve posts. If they gave you something, share them with a colleague.&lt;/p>
&lt;h2 id="references">References&lt;/h2>
&lt;p>eBPF in local inference:&lt;/p>
&lt;ul>
&lt;li>&lt;a href="https://arxiv.org/abs/2601.20755">ProfInfer: An eBPF-based Fine-Grained LLM Inference Profiler (arxiv 2601.20755)&lt;/a> — the 2026 reference paper.&lt;/li>
&lt;li>&lt;a href="https://www.glukhov.org/observability/monitoring-llm-inference-prometheus-grafana/">Monitor LLM Inference in Production 2026 (Glukhov)&lt;/a> — Prometheus + Grafana for vLLM/TGI/llama.cpp.&lt;/li>
&lt;li>&lt;a href="https://www.armosec.io/blog/observability-for-ai-inference-servers/">AI Inference Server Observability in Kubernetes (ARMO)&lt;/a> — the four signals MLOps tools do not capture.&lt;/li>
&lt;li>&lt;a href="https://developers.redhat.com/articles/2025/09/30/vllm-or-llamacpp-choosing-right-llm-inference-engine-your-use-case">vLLM vs llama.cpp: Choosing the right engine (Red Hat)&lt;/a>.&lt;/li>
&lt;/ul>
&lt;p>Drift detection concepts:&lt;/p>
&lt;ul>
&lt;li>&lt;a href="https://futureagi.com/blog/what-is-llm-drift-2026">What is LLM Drift? Types, Detection, Mitigation 2026 (FutureAGI)&lt;/a>.&lt;/li>
&lt;li>&lt;a href="https://stackpulsar.com/blog/llm-model-drift-detection/">LLM Model Drift Detection 2026 (Stack Pulsar)&lt;/a>.&lt;/li>
&lt;li>&lt;a href="https://galileo.ai/blog/best-llm-output-drift-monitoring-platforms">9 Best LLM Drift Monitoring Platforms in 2026 (Galileo)&lt;/a>.&lt;/li>
&lt;li>&lt;a href="https://arxiv.org/abs/2404.18673">Open-Source Drift Detection Tools in Action (arxiv 2404.18673)&lt;/a>.&lt;/li>
&lt;li>&lt;a href="https://arxiv.org/abs/2309.10000">Detecting covariate drift in text data using document embeddings (arxiv 2309.10000)&lt;/a>.&lt;/li>
&lt;li>&lt;a href="https://futureagi.com/blog/best-ai-drift-detection-tools-2026">Best AI Drift Detection Tools in 2026 (FutureAGI)&lt;/a>.&lt;/li>
&lt;/ul>
&lt;p>Tools:&lt;/p>
&lt;ul>
&lt;li>&lt;a href="https://github.com/evidentlyai/evidently">Evidently AI (GitHub)&lt;/a> — open-source.&lt;/li>
&lt;li>&lt;a href="https://www.evidentlyai.com/">Evidently — official site&lt;/a>.&lt;/li>
&lt;li>&lt;a href="https://www.nannyml.com/">NannyML&lt;/a> — performance without ground truth.&lt;/li>
&lt;li>&lt;a href="https://whylabs.ai/">WhyLabs&lt;/a> — managed observability.&lt;/li>
&lt;li>&lt;a href="https://github.com/SeldonIO/alibi-detect">Alibi Detect (Seldon)&lt;/a> — general drift detection.&lt;/li>
&lt;li>&lt;a href="https://phoenix.arize.com/">Arize Phoenix&lt;/a> — drift integrated with tracing.&lt;/li>
&lt;/ul>
&lt;p>Statistical tests:&lt;/p>
&lt;ul>
&lt;li>&lt;a href="https://mlpipeline-cloud.com/blog/data-drift-detection-psi-ks">Data drift detection: PSI vs Kolmogorov–Smirnov (MLPipeline)&lt;/a> — a practical comparison.&lt;/li>
&lt;li>&lt;a href="https://brandonwie.dev/posts/psi-model-drift-detection">Population Stability Index for Model Drift Detection&lt;/a>.&lt;/li>
&lt;li>&lt;a href="https://www.evidentlyai.com/blog/data-drift-detection-large-datasets">Which test is the best? 5 methods to detect data drift (Evidently)&lt;/a> — the 6 hours of advantage for KS.&lt;/li>
&lt;/ul>
&lt;p>Cross-references (the three complete series):&lt;/p>
&lt;ul>
&lt;li>LLM inference series: &lt;a href="https://blog.lo0.es/en/posts/kv-cache-working-memory-llm-inference/">KV cache&lt;/a>, &lt;a href="https://blog.lo0.es/en/posts/vllm-kubernetes-llm-inference-that-scales/">vLLM on K8s&lt;/a>, &lt;a href="https://blog.lo0.es/en/posts/pagedattention-vllm-block-manager/">PagedAttention&lt;/a>, &lt;a href="https://blog.lo0.es/en/posts/llm-inference-operators-kubernetes/">LLM K8s Operators&lt;/a>.&lt;/li>
&lt;li>eBPF series: &lt;a href="https://blog.lo0.es/en/posts/ebpf-zero-to-cilium-kernel-tcp-ip-bypass/">eBPF from zero to Cilium&lt;/a>, &lt;a href="https://blog.lo0.es/en/posts/tetragon-cilium-security-syscalls-kernel/">Tetragon&lt;/a>, &lt;a href="https://blog.lo0.es/en/posts/hubble-ebpf-network-observability-ai-agents/">Hubble&lt;/a>, &lt;a href="https://blog.lo0.es/en/posts/agentsight-llm-tracing-ebpf-zero-instrumentation/">AgentSight&lt;/a>.&lt;/li>
&lt;li>Post-tracing series: &lt;a href="https://blog.lo0.es/en/posts/evals-llm-layer-after-tracing/">Evals&lt;/a>, &lt;a href="https://blog.lo0.es/en/posts/llm-guardrails-safety-four-lines-of-defence/">Guardrails&lt;/a>, &lt;a href="https://blog.lo0.es/en/posts/mcp-deep-observability-opentelemetry/">MCP observability&lt;/a>.&lt;/li>
&lt;/ul></description></item><item><title>AgentSight and the new LLM tracing: zero-instrumentation with eBPF against Langfuse, LangSmith, Phoenix and company</title><link>https://blog.lo0.es/en/posts/agentsight-llm-tracing-ebpf-zero-instrumentation/</link><pubDate>Tue, 19 May 2026 18:00:00 +0200</pubDate><guid>https://blog.lo0.es/en/posts/agentsight-llm-tracing-ebpf-zero-instrumentation/</guid><description>&lt;h2 id="tldr">TL;DR&lt;/h2>
&lt;p>Observing an LLM agent in production in 2026 splits into two approaches with opposite philosophies. The &lt;strong>instrumented&lt;/strong> one, dominant until 2025, lives in tools such as &lt;a href="https://langfuse.com/">Langfuse&lt;/a>, &lt;a href="https://www.langchain.com/langsmith">LangSmith&lt;/a>, &lt;a href="https://phoenix.arize.com/">Arize Phoenix&lt;/a>, &lt;a href="https://www.helicone.ai/">Helicone&lt;/a>, &lt;a href="https://www.traceloop.com/openllmetry">OpenLLMetry/Traceloop&lt;/a> or &lt;a href="https://pydantic.dev/logfire">Pydantic Logfire&lt;/a>: you install an SDK, decorate your calls, emit spans with the &lt;strong>OpenTelemetry GenAI&lt;/strong> convention (&lt;code>gen_ai.request.model&lt;/code>, &lt;code>gen_ai.usage.input_tokens&lt;/code>, and so on) and export them to a backend. Enormous depth when you control the code; zero visibility when the agent is an opaque binary you run without instrumenting. The &lt;strong>zero-instrumentation&lt;/strong> one, which &lt;a href="https://github.com/eunomia-bpf/agentsight">AgentSight&lt;/a> popularised in the second half of 2025, turns the perspective 180º: it puts &lt;strong>eBPF hooks on the uprobes of the SSL/TLS libraries&lt;/strong> and captures the plaintext of every HTTPS request before encryption, &lt;strong>without touching the app&amp;rsquo;s code&lt;/strong>, with less than &lt;strong>3% overhead&lt;/strong> and the guarantee of being &lt;strong>tamper-proof&lt;/strong> (the agent cannot falsify what is seen in the kernel). Combined with BPF capture of stdio for local MCP servers, AgentSight gives you complete observability of any agent, including closed binaries such as Claude Code, Gemini CLI or Cursor, on a Kubernetes cluster. The two families are not enemies: the 2026 reference stack combines both (instrumented for your own apps with LangChain, eBPF for opaque binaries and tamper-proof compliance) over &lt;strong>OpenTelemetry GenAI semantic conventions&lt;/strong> as the common vocabulary the ecosystem is stabilising this year.&lt;/p>
&lt;blockquote>
&lt;p>This is the &lt;strong>fourth and last post of the eBPF series&lt;/strong>. Part 1: &lt;a href="https://blog.lo0.es/en/posts/ebpf-zero-to-cilium-kernel-tcp-ip-bypass/">eBPF from zero to Cilium&lt;/a>. Part 2: &lt;a href="https://blog.lo0.es/en/posts/tetragon-cilium-security-syscalls-kernel/">Tetragon: runtime security&lt;/a>. Part 3: &lt;a href="https://blog.lo0.es/en/posts/hubble-ebpf-network-observability-ai-agents/">Hubble: network observability&lt;/a>. Here we close the circle with the &lt;strong>semantic&lt;/strong> dimension: what an AI agent does, not only what network it opens or what syscalls it emits.&lt;/p>
&lt;/blockquote>
&lt;h2 id="the-analogy-traditional-apm-vs-network-sniffer">The analogy: traditional APM vs network sniffer&lt;/h2>
&lt;p>Anyone who has operated enterprise applications knows the two tribes of monitoring. The &lt;strong>APM&lt;/strong> tribe (New Relic, AppDynamics, Datadog APM): you install an agent or an SDK in each application, mark spans, collect traces with enormous depth inside each process, down to lines of code, SQL queries, Java methods. The &lt;strong>wire-level&lt;/strong> tribe (network sniffers, SolarWinds NPM-style tools, NetFlow): it does not touch the application; it observes the cable, sees protocols, latencies, retransmissions, identifies problems the app does not know it has.&lt;/p>
&lt;p>Each one sees different things and both are useful. Anyone who has lived through a serious incident where APM said &amp;ldquo;all green&amp;rdquo; while users suffered knows that wire-level would have caught the problem (a saturated middlebox, a badly configured MTU, a TCP timeout). Anyone who has tried to debug a memory leak with sniffers knows it was impossible without APM.&lt;/p>
&lt;p>LLM agent observability in 2026 is exactly at this point. The &lt;strong>APM-style&lt;/strong> has been in place for a couple of years: Langfuse, LangSmith, Phoenix, OpenLLMetry. Enormous depth, requires instrumenting the app. The &lt;strong>wire-level with eBPF&lt;/strong> has just arrived: AgentSight is the first project to take it to production. Less depth inside the agent, but it sees any agent without touching anything and it is &lt;strong>tamper-proof&lt;/strong>. Both are useful. The industry is in full coexistence.&lt;/p>
&lt;h2 id="why-observing-llm-agents-is-different">Why observing LLM agents is different&lt;/h2>
&lt;p>Before getting into tools, it is worth pausing on what makes LLM agents specific as subjects of observability:&lt;/p>
&lt;p>&lt;strong>Non-determinism.&lt;/strong> The same input can produce different outputs. Reproducing an incident requires capturing &lt;strong>exactly&lt;/strong> the conversation, the model, the parameters and, ideally, the seed. An aggregate &amp;ldquo;p95 latency&amp;rdquo; metric falls short; what you need is replay of the individual trace.&lt;/p>
&lt;p>&lt;strong>A chain of external invocations.&lt;/strong> A typical agent calls LLM → tools (tool calling) → MCP servers → other APIs → back to the LLM. A chat session can generate &lt;strong>dozens of chained calls&lt;/strong> that have to be correlated by trace_id to understand the decision.&lt;/p>
&lt;p>&lt;strong>Cost linear in tokens.&lt;/strong> Every call is paid for in tokens. Without tracing input/output tokens per request, you cannot assign cost to a tenant or a team, nor detect loops that eat your budget in an hour.&lt;/p>
&lt;p>&lt;strong>Semantic risk.&lt;/strong> Prompt injection (a user input containing instructions to manipulate the model), jailbreaks, secret leakage through tool calls. It is a class of problem that does not appear in traditional applications, and observability must see it.&lt;/p>
&lt;p>&lt;strong>Opaque binaries.&lt;/strong> In 2026, many teams deploy &lt;strong>third-party agents&lt;/strong> such as Claude Code, the Cursor agent, Aider, Gemini CLI or Codex CLI as internal tools. They are not your own applications; they are closed binaries that call the vendor&amp;rsquo;s API. Instrumenting them is impossible. Observing them requires something else.&lt;/p>
&lt;p>&lt;strong>Multi-agent and orchestration.&lt;/strong> More and more architectures have agents that invoke other agents (planner → executor → critic). Observability must understand the topology, not just the individual span.&lt;/p>
&lt;p>With these five points in mind, the tools we are about to see differ mainly in &lt;strong>which parts&lt;/strong> of the problem they cover well and &lt;strong>which parts&lt;/strong> they leave blind.&lt;/p>
&lt;h2 id="the-instrumented-approach-how-it-works">The instrumented approach: how it works&lt;/h2>
&lt;p>The model is direct and familiar:&lt;/p>
&lt;ol>
&lt;li>Your code calls the LLM or the tools using an official library: &lt;code>openai&lt;/code>, &lt;code>anthropic&lt;/code>, &lt;code>langchain&lt;/code>, &lt;code>llama_index&lt;/code>, &lt;code>dspy&lt;/code>.&lt;/li>
&lt;li>You install a tracer SDK (Langfuse, LangSmith, OpenLLMetry, Logfire) that &lt;strong>wraps&lt;/strong> or &lt;strong>monkey-patches&lt;/strong> those libraries.&lt;/li>
&lt;li>Each call emits an &lt;strong>OpenTelemetry span&lt;/strong> with standardised attributes: model used, input/output tokens, latency, parameters, messages, tool invoked, result.&lt;/li>
&lt;li>The spans are exported over OTLP to a backend that shows them as a tree of traces.&lt;/li>
&lt;/ol>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-python" data-lang="python">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Typical example with OpenLLMetry + any SDK&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="kn">from&lt;/span> &lt;span class="nn">traceloop.sdk&lt;/span> &lt;span class="kn">import&lt;/span> &lt;span class="n">Traceloop&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="kn">from&lt;/span> &lt;span class="nn">openai&lt;/span> &lt;span class="kn">import&lt;/span> &lt;span class="n">OpenAI&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">Traceloop&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">init&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">app_name&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="s2">&amp;#34;my-agent&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">api_endpoint&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="s2">&amp;#34;https://otel-collector:4318&amp;#34;&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">client&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">OpenAI&lt;/span>&lt;span class="p">()&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># this call automatically emits a span with&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># gen_ai.request.model, gen_ai.usage.input_tokens, etc.&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">resp&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">client&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">chat&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">completions&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">create&lt;/span>&lt;span class="p">(&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">model&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="s2">&amp;#34;gpt-4.1&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">messages&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="p">[{&lt;/span>&lt;span class="s2">&amp;#34;role&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;user&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="s2">&amp;#34;content&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;...&amp;#34;&lt;/span>&lt;span class="p">}]&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>What you see afterwards: a dashboard with each conversation as a trace, each call as a span, the complete prompts and completions (if you opt in), the computed cost, latencies per span, errors flagged.&lt;/p>
&lt;h3 id="opentelemetry-genai-semantic-conventions-the-common-vocabulary">OpenTelemetry GenAI semantic conventions: the common vocabulary&lt;/h3>
&lt;p>The fragmentation of the field is being mitigated with &lt;a href="https://opentelemetry.io/docs/specs/semconv/gen-ai/">&lt;strong>OpenTelemetry GenAI Semantic Conventions&lt;/strong>&lt;/a>. It is the CNCF&amp;rsquo;s effort to get &lt;strong>all&lt;/strong> tools to emit spans with the same attribute names:&lt;/p>
&lt;ul>
&lt;li>&lt;code>gen_ai.system&lt;/code> — the provider (openai, anthropic, vertex_ai, and so on).&lt;/li>
&lt;li>&lt;code>gen_ai.request.model&lt;/code> — the model requested (&lt;code>gpt-4.1&lt;/code>, &lt;code>claude-3-5-sonnet&lt;/code>).&lt;/li>
&lt;li>&lt;code>gen_ai.response.model&lt;/code> — the model actually used (sometimes it differs, e.g. fallbacks).&lt;/li>
&lt;li>&lt;code>gen_ai.usage.input_tokens&lt;/code> and &lt;code>gen_ai.usage.output_tokens&lt;/code> — counters.&lt;/li>
&lt;li>&lt;code>gen_ai.request.temperature&lt;/code>, &lt;code>gen_ai.request.top_p&lt;/code>, and so on — parameters.&lt;/li>
&lt;li>&lt;code>gen_ai.response.finish_reasons&lt;/code> — why it ended (stop, length, content_filter).&lt;/li>
&lt;li>&lt;code>gen_ai.operation.name&lt;/code> — the type of operation (chat, embedding, completion).&lt;/li>
&lt;/ul>
&lt;p>In early 2026, the &lt;strong>client spans&lt;/strong> moved from experimental to stable. The rest (server spans, multi-agent events) is still in development. The operational meaning: if your SDK emits these attributes, &lt;strong>any backend that understands OTel GenAI&lt;/strong> can consume them. Moving from Langfuse to Phoenix to Helicone does not imply re-instrumenting, only changing the exporter.&lt;/p>
&lt;p>The SIG is actively developing &lt;strong>conventions for multi-agent systems&lt;/strong>: agent teams, tasks, actions, memory, artifact tracking. This is what is missing for complex agent architectures to have a common vocabulary. In 2026 it is experimental; stabilisation is expected at the end of the year or the start of 2027.&lt;/p>
&lt;h3 id="instrumented-tools-the-2026-landscape">Instrumented tools: the 2026 landscape&lt;/h3>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Tool&lt;/th>
&lt;th>Licence&lt;/th>
&lt;th>Self-host&lt;/th>
&lt;th>Focus&lt;/th>
&lt;th>Where it shines&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;strong>Langfuse&lt;/strong>&lt;/td>
&lt;td>MIT&lt;/td>
&lt;td>&lt;strong>Yes&lt;/strong>&lt;/td>
&lt;td>LLM observability + evals + prompt mgmt&lt;/td>
&lt;td>Best OSS balance, complete suite&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>LangSmith&lt;/strong>&lt;/td>
&lt;td>Commercial&lt;/td>
&lt;td>No&lt;/td>
&lt;td>Native LangChain/LangGraph&lt;/td>
&lt;td>If you use LangChain, zero-config integration&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Arize Phoenix&lt;/strong>&lt;/td>
&lt;td>ELv2 (OSS)&lt;/td>
&lt;td>Yes&lt;/td>
&lt;td>OTel-native, strong RAG&lt;/td>
&lt;td>Vector DBs, retrieval, embeddings&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Helicone&lt;/strong>&lt;/td>
&lt;td>Commercial + OSS lite&lt;/td>
&lt;td>Yes (lite)&lt;/td>
&lt;td>Simple proxy&lt;/td>
&lt;td>Setup in minutes, OpenAI-only&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>OpenLLMetry / Traceloop&lt;/strong>&lt;/td>
&lt;td>Apache 2.0&lt;/td>
&lt;td>Yes&lt;/td>
&lt;td>OTel SDK for LLMs&lt;/td>
&lt;td>Vendor-neutral, exports to any OTel backend&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Pydantic Logfire&lt;/strong>&lt;/td>
&lt;td>Commercial&lt;/td>
&lt;td>No&lt;/td>
&lt;td>App + LLM unified&lt;/td>
&lt;td>If you use Pydantic AI, native integration&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Weights &amp;amp; Biases Weave&lt;/strong>&lt;/td>
&lt;td>Commercial&lt;/td>
&lt;td>Limited&lt;/td>
&lt;td>Experimentation + production&lt;/td>
&lt;td>If you already use W&amp;amp;B for training&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Laminar / Braintrust&lt;/strong>&lt;/td>
&lt;td>Commercial&lt;/td>
&lt;td>No / Yes&lt;/td>
&lt;td>Evals + tracing&lt;/td>
&lt;td>More recent, focused on evaluation&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;h3 id="deep-dive-langfuse">Deep dive: Langfuse&lt;/h3>
&lt;p>It is worth pausing on &lt;a href="https://langfuse.com/">Langfuse&lt;/a> because in 2026 it is &lt;strong>the default choice among the open-source options&lt;/strong> and the one most teams have adopted this year. It is a &lt;a href="https://github.com/langfuse/langfuse">YC W23&lt;/a> project, &lt;strong>MIT&lt;/strong> licence, and keeps a sustained release cadence with serious architectural changes between versions.&lt;/p>
&lt;p>&lt;strong>Four declared pillars&lt;/strong>: observability (tracing), evaluations, prompt management, playground/datasets. Each one separately has complete commercial products behind it; Langfuse integrates them into a single platform with a single backend.&lt;/p>
&lt;h4 id="sdk-v4-otel-native-not-a-replacement">SDK v4: OTEL-native, not a replacement&lt;/h4>
&lt;p>The big recent operational change is the &lt;strong>SDK v4&lt;/strong>, a thin layer over the official OpenTelemetry client. The choice is deliberate: instead of maintaining a client of its own that would fall behind the OTel primitives, Langfuse uses the standard SDK and &lt;strong>enriches&lt;/strong> the spans with LLM-specific attributes and helpers. The consequence: any code already instrumented with vanilla OpenTelemetry (&lt;code>@opentelemetry/sdk-node&lt;/code>, &lt;code>opentelemetry-sdk&lt;/code> in Python) &lt;strong>can export to Langfuse without major changes&lt;/strong>, and the other way round, if tomorrow you want to migrate from Langfuse to another OTel backend, the spans are portable.&lt;/p>
&lt;p>In Python the idiomatic decorator is &lt;code>@observe&lt;/code>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-python" data-lang="python">&lt;span class="line">&lt;span class="cl">&lt;span class="kn">from&lt;/span> &lt;span class="nn">langfuse&lt;/span> &lt;span class="kn">import&lt;/span> &lt;span class="n">observe&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">get_client&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">langfuse&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">get_client&lt;/span>&lt;span class="p">()&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nd">@observe&lt;/span>&lt;span class="p">()&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="k">def&lt;/span> &lt;span class="nf">buscar_documentos&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">query&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="nb">str&lt;/span>&lt;span class="p">):&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="c1"># any internal call is traced as well&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="k">return&lt;/span> &lt;span class="n">vector_store&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">similarity_search&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">query&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nd">@observe&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">as_type&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="s2">&amp;#34;generation&amp;#34;&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="k">def&lt;/span> &lt;span class="nf">llamar_llm&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">prompt&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="nb">str&lt;/span>&lt;span class="p">):&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="c1"># marked as &amp;#34;generation&amp;#34; so it appears with LLM metadata&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="k">return&lt;/span> &lt;span class="n">openai_client&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">chat&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">completions&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">create&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="o">...&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nd">@observe&lt;/span>&lt;span class="p">()&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="k">def&lt;/span> &lt;span class="nf">pipeline_rag&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">pregunta&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="nb">str&lt;/span>&lt;span class="p">):&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">docs&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">buscar_documentos&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">pregunta&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="k">return&lt;/span> &lt;span class="n">llamar_llm&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">build_prompt&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">pregunta&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">docs&lt;/span>&lt;span class="p">))&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The call tree is captured automatically: the trace shows &lt;code>pipeline_rag&lt;/code> as the root span, with &lt;code>buscar_documentos&lt;/code> and &lt;code>llamar_llm&lt;/code> as children, nested. Without writing a single &lt;code>with tracer.start_as_current_span(...)&lt;/code> by hand.&lt;/p>
&lt;p>In TypeScript the equivalent is modular: you install &lt;code>@langfuse/tracing&lt;/code>, &lt;code>@langfuse/otel&lt;/code> and &lt;code>@opentelemetry/sdk-node&lt;/code>, and you can use TS decorators, context managers or manual spans, the three models interoperate. The consequence: third-party libraries that emit OTel spans (&lt;code>openai&lt;/code>, &lt;code>@anthropic-ai/sdk&lt;/code>, Vercel AI SDK instrumentations) show up in Langfuse with no extra work.&lt;/p>
&lt;h4 id="self-host-architecture-designed-for-serious-production">Self-host architecture: designed for serious production&lt;/h4>
&lt;p>The Langfuse backend architecture has &lt;strong>two explicit decisions&lt;/strong> that set its self-host deployment apart:&lt;/p>
&lt;ol>
&lt;li>
&lt;p>&lt;strong>Persistence in S3/Blob Storage first&lt;/strong>. When a tracing event arrives, &lt;strong>it is persisted in object storage before touching the database&lt;/strong>. Only when the later processing confirms OK is it inserted into Postgres/Clickhouse. If the DB goes down temporarily, the events &lt;strong>are not lost&lt;/strong>; they stay in S3 waiting to be reprocessed. For production where losing the traces of an incident is equivalent to losing evidence, this is load-bearing.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Long migrations as background jobs&lt;/strong>. Schema upgrades that on other platforms mean a downtime window run in the background on Langfuse while the application keeps serving. Upgrade downtime drops drastically.&lt;/p>
&lt;/li>
&lt;/ol>
&lt;p>The officially supported deployment modes:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Docker Compose&lt;/strong>: for development and POCs. One command, everything up.&lt;/li>
&lt;li>&lt;strong>VM&lt;/strong>: a single node, containers, no orchestration. For small environments.&lt;/li>
&lt;li>&lt;strong>Kubernetes with Helm&lt;/strong>: the recommended mode for production. Official chart maintained. Supports external Postgres, external Clickhouse, external S3, HPA.&lt;/li>
&lt;/ul>
&lt;p>The external dependencies in a typical production setup: &lt;strong>Postgres&lt;/strong> (metadata, prompts, configuration), &lt;strong>Clickhouse&lt;/strong> (tracing events, high-cardinality queries), &lt;strong>S3 or a compatible blob store&lt;/strong> (pending events), &lt;strong>Redis&lt;/strong> (the queue between components). Yes, that is several pieces; it is what holds up the durability and the scale.&lt;/p>
&lt;h4 id="prompt-management-as-a-first-class-citizen">Prompt management as a first-class citizen&lt;/h4>
&lt;p>What sets Langfuse apart from platforms focused only on tracing is that &lt;strong>the prompts live in Langfuse&lt;/strong>, not in the application repo or in spreadsheets. Each prompt has:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Name and version&lt;/strong> (v1, v2, v3&amp;hellip;). Changing the prompt does not require redeploying the app: the app asks the SDK for the prompt, and the SDK caches it and refreshes when there is a new version.&lt;/li>
&lt;li>&lt;strong>Typed variables&lt;/strong>: &lt;code>{{user_input}}&lt;/code>, &lt;code>{{context}}&lt;/code>. Rendering with validation.&lt;/li>
&lt;li>&lt;strong>Tags and labels&lt;/strong>: by environment (&lt;code>production&lt;/code>, &lt;code>staging&lt;/code>), by team, by experiment.&lt;/li>
&lt;li>&lt;strong>Client and server cache&lt;/strong>: the SDK caches locally with a configurable TTL, avoiding a roundtrip to Langfuse on every call.&lt;/li>
&lt;li>&lt;strong>Linkage with traces&lt;/strong>: each trace records which exact version of which prompt was used. Investigating &amp;ldquo;this answer came out wrong&amp;rdquo; leads to prompt version Y, not to &amp;ldquo;some version of the prompt at some point&amp;rdquo;.&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-python" data-lang="python">&lt;span class="line">&lt;span class="cl">&lt;span class="kn">from&lt;/span> &lt;span class="nn">langfuse&lt;/span> &lt;span class="kn">import&lt;/span> &lt;span class="n">get_client&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">langfuse&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">get_client&lt;/span>&lt;span class="p">()&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">prompt&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">langfuse&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">get_prompt&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="s2">&amp;#34;rag-system-prompt&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">version&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="mi">3&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># or by label: langfuse.get_prompt(&amp;#34;rag-system-prompt&amp;#34;, label=&amp;#34;production&amp;#34;)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">compiled&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">prompt&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">compile&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">context&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="n">docs_text&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">user_input&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="n">question&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># &amp;#39;compiled&amp;#39; is the final string, ready to send to the LLM&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>For teams iterating on prompts daily, this is what avoids the chaos of &amp;ldquo;which version of the prompt is actually running in production right now&amp;rdquo;.&lt;/p>
&lt;h4 id="evaluations-four-combinable-evaluation-models">Evaluations: four combinable evaluation models&lt;/h4>
&lt;p>Langfuse covers the four patterns of answer evaluation:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>LLM-as-a-judge&lt;/strong>: you configure a model (typically GPT-4 or Claude) with a rubric and it evaluates each answer. Result: a numeric score (0-1) and a justification. Applicable to automatic tracing (all answers) or batch (a dataset selection).&lt;/li>
&lt;li>&lt;strong>User feedback&lt;/strong>: the app lets the user mark an answer as good/bad. The feedback is associated with the trace and the prompt version, which lets you see which versions have a worse rate.&lt;/li>
&lt;li>&lt;strong>Manual labeling&lt;/strong>: a UI where human labelers score answers. Useful for golden datasets and for evaluating the judge.&lt;/li>
&lt;li>&lt;strong>Custom evaluators through the API/SDK&lt;/strong>: your own evals (a unit test, a business metric) report a score through the API. They integrate with CI.&lt;/li>
&lt;/ul>
&lt;p>Combined, they give &lt;strong>regression testing&lt;/strong> of the prompt: you change from v3 to v4, evaluate the golden dataset with LLM-as-judge, compare; if v4 gets worse in any of the segments, the merge fails.&lt;/p>
&lt;h4 id="integrations">Integrations&lt;/h4>
&lt;p>Langfuse does not compete with OpenLLMetry, LangChain or LiteLLM: it &lt;strong>integrates&lt;/strong> them. The ones that are tested and documented:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>OpenTelemetry&lt;/strong>: any OTel instrumentation emits to Langfuse over OTLP.&lt;/li>
&lt;li>&lt;strong>LangChain and LangGraph&lt;/strong>: a native callback that captures the whole chain.&lt;/li>
&lt;li>&lt;strong>LlamaIndex&lt;/strong>: native callback.&lt;/li>
&lt;li>&lt;strong>OpenAI SDK&lt;/strong> (Python and TS): a wrapper that adds tracing automatically.&lt;/li>
&lt;li>&lt;strong>LiteLLM&lt;/strong>: integration as a callback, which covers 100+ providers through LiteLLM.&lt;/li>
&lt;li>&lt;strong>OpenLLMetry / Traceloop&lt;/strong>: they emit to Langfuse like any OTel backend.&lt;/li>
&lt;li>&lt;strong>MLflow&lt;/strong>: through an OTel exporter from MLflow to Langfuse.&lt;/li>
&lt;li>&lt;strong>Vercel AI SDK&lt;/strong>: native instrumentation.&lt;/li>
&lt;/ul>
&lt;p>The strategy is clear: &lt;strong>Langfuse is a backend, not an SDK&lt;/strong>. Your team chooses how it instruments; Langfuse accepts any path. The operational consequence: moving from Langfuse to another OTel backend tomorrow is viable.&lt;/p>
&lt;h4 id="when-langfuse-is-not-the-answer">When Langfuse is not the answer&lt;/h4>
&lt;p>So as not to present it as a silver bullet:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>If you only use LangChain and have no resources to self-host&lt;/strong>: LangSmith will give you a smoother integration (it is the same team).&lt;/li>
&lt;li>&lt;strong>If your only need is a proxy with cost tracking and no evals&lt;/strong>: Helicone is simpler.&lt;/li>
&lt;li>&lt;strong>If you want an integrated commercial vendor solution&lt;/strong>: Datadog LLM Observability, New Relic AI Monitoring or Dynatrace AI are Enterprise alternatives with 24/7 support.&lt;/li>
&lt;li>&lt;strong>If your load is pure batch massive inference with no agents&lt;/strong>: you probably do not need semantic tracing; Prometheus + Grafana with OTel metrics is enough.&lt;/li>
&lt;/ul>
&lt;p>For everything else, your own apps with serious tracing, multi-tenant with quotas, teams iterating on prompts daily, RAG with continuous evaluation, Langfuse is the safe bet.&lt;/p>
&lt;p>&lt;strong>Quick choice summary&lt;/strong>:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>LangChain → LangSmith&lt;/strong> (zero effort, automatic instrumentation).&lt;/li>
&lt;li>&lt;strong>Your own multi-framework applications with OSS → Langfuse&lt;/strong> (MIT, self-host, complete).&lt;/li>
&lt;li>&lt;strong>RAG with vector stores → Arize Phoenix&lt;/strong> (better retrieval visibility).&lt;/li>
&lt;li>&lt;strong>Simple proxy, low budget → Helicone&lt;/strong>.&lt;/li>
&lt;li>&lt;strong>Strict vendor neutrality → OpenLLMetry/Traceloop&lt;/strong>.&lt;/li>
&lt;li>&lt;strong>Pydantic AI → Logfire&lt;/strong> (same team).&lt;/li>
&lt;/ul>
&lt;h3 id="strengths-and-weaknesses-of-the-instrumented-model">Strengths and weaknesses of the instrumented model&lt;/h3>
&lt;p>&lt;strong>Strengths&lt;/strong>:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Enormous depth&lt;/strong>: nested spans with all the context (chain steps, retrieval, embeddings, tool calls).&lt;/li>
&lt;li>&lt;strong>Semantic vocabulary&lt;/strong>: the SDK knows the domain (LLM, vector store, agent).&lt;/li>
&lt;li>&lt;strong>Maturity&lt;/strong>: three years of evolution, a rich ecosystem, ready-made dashboards.&lt;/li>
&lt;li>&lt;strong>Built-in evals&lt;/strong>: the top platforms combine tracing with evaluation (judge LLM, datasets, regression).&lt;/li>
&lt;/ul>
&lt;p>&lt;strong>Weaknesses&lt;/strong>:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Requires control of the code&lt;/strong>: if you cannot instrument, it does not work.&lt;/li>
&lt;li>&lt;strong>Trust in the app&lt;/strong>: if the app reports badly or has a bug, so does the trace. It is not tamper-proof.&lt;/li>
&lt;li>&lt;strong>Coupling to the SDK&lt;/strong>: version changes in a library can break the instrumentation.&lt;/li>
&lt;li>&lt;strong>Uneven coverage&lt;/strong>: Python SDKs are mature; Go, Rust and JS are younger.&lt;/li>
&lt;/ul>
&lt;h2 id="the-zero-instrumentation-approach-agentsight">The zero-instrumentation approach: AgentSight&lt;/h2>
&lt;p>&lt;a href="https://github.com/eunomia-bpf/agentsight">AgentSight&lt;/a> is the project from the &lt;code>eunomia-bpf&lt;/code> group that champions the opposite approach. Its &lt;a href="https://arxiv.org/abs/2508.02736">paper on arxiv (2508.02736)&lt;/a>, presented at the &lt;em>Workshop on Practical Adoption Challenges of ML for Systems&lt;/em>, formalises the proposal. The premise is direct:&lt;/p>
&lt;blockquote>
&lt;p>&lt;em>Instead of instrumenting the agent, observe it at the system boundary.&lt;/em>&lt;/p>
&lt;/blockquote>
&lt;p>And &amp;ldquo;system boundary&amp;rdquo; means &lt;strong>the kernel boundary&lt;/strong>: the last point before a piece of data leaves the process towards the network or the filesystem. There, with eBPF, things are seen as they are, without the application being able to cooperate in hiding them.&lt;/p>
&lt;h3 id="architecture-three-planes">Architecture: three planes&lt;/h3>
&lt;p>AgentSight assembles three layers:&lt;/p>
&lt;p>&lt;strong>Plane 1 — SSL/TLS uprobes&lt;/strong>. eBPF can attach programs to functions in &lt;strong>userspace libraries&lt;/strong> (uprobes). The target functions are the encryption ones: &lt;code>SSL_write&lt;/code>, &lt;code>SSL_read&lt;/code> from OpenSSL/BoringSSL, and their equivalents in Rustls. AgentSight puts hooks on them that &lt;strong>capture the arguments&lt;/strong>: the &lt;strong>plaintext&lt;/strong> buffer the app passes to be encrypted, just before TLS processes it. On reception it does the symmetric thing: a hook after &lt;code>SSL_read&lt;/code> with the freshly decrypted plaintext. Result: AgentSight sees the complete content of any HTTPS request the app makes &lt;strong>without needing a man-in-the-middle, certificates or traffic decryption&lt;/strong>. The payload is plaintext because it was captured &lt;strong>before&lt;/strong> being encrypted.&lt;/p>
&lt;p>This works because uprobes are cheap (around 100 ns per invocation) and because apps use common TLS libraries. The few apps that implement their own TLS (rare in production) escape this hook; for those you need a different kprobe or manual instrumentation.&lt;/p>
&lt;p>&lt;strong>Plane 2 — Kernel events&lt;/strong>. In parallel, AgentSight observes relevant syscalls through tracepoints: &lt;code>execve&lt;/code> (which processes start), &lt;code>connect&lt;/code>/&lt;code>accept&lt;/code> (network), &lt;code>read&lt;/code>/&lt;code>write&lt;/code> with file descriptors (filesystem and stdio), &lt;code>unlink&lt;/code>, &lt;code>clone&lt;/code>. Any action by the agent that has an effect outside the process passes through here. This covers, among other things, &lt;strong>shell commands executed by the agent&lt;/strong>: if a Claude Code agent decides to run &lt;code>rm -rf&lt;/code> to &amp;ldquo;clean up the project&amp;rdquo;, the &lt;code>execve&lt;/code> is seen even if the LLM API does not report it.&lt;/p>
&lt;p>&lt;strong>Plane 3 — Correlation engine&lt;/strong>. The two previous planes produce streams of asynchronous events. AgentSight has a userspace component that &lt;strong>correlates them causally cross-process&lt;/strong>: an outgoing HTTP request with &lt;code>bash -c rm -rf&lt;/code> can be correlated with the previous LLM response that suggested it, through PIDs, timings and heuristics. The paper mentions the optional use of &lt;strong>a secondary LLM&lt;/strong> (Anthropic Claude, for instance) that analyses the sequence of events and produces semantic alerts: &amp;ldquo;the agent responded with a tool call that was not in the whitelist&amp;rdquo;, &amp;ldquo;the reasoning chain has gone 47 iterations without converging&amp;rdquo;.&lt;/p>
&lt;h3 id="stdiocap-capturing-the-stdio-of-local-mcp-servers">&lt;code>stdiocap&lt;/code>: capturing the stdio of local MCP servers&lt;/h3>
&lt;p>One specific piece that deserves its own mention is &lt;code>stdiocap&lt;/code>, a separate BPF tool included in the repo. The &lt;strong>Model Context Protocol (MCP)&lt;/strong>, popularised by Anthropic in 2024 and mainstream in 2025-2026, has two transport modes: HTTP/SSE (network) and &lt;strong>stdio&lt;/strong> (between the client and the server it starts as a subprocess). Local MCP servers, the ones that run on the same machine and are started by the client as children over pipes, communicate through stdin/stdout/stderr with JSON-RPC.&lt;/p>
&lt;p>&lt;code>stdiocap&lt;/code> hooks &lt;code>read&lt;/code>/&lt;code>write&lt;/code>/&lt;code>dup&lt;/code> on the stdin/stdout/stderr file descriptors of a target process and &lt;strong>records all the JSON-RPC traffic&lt;/strong> between the MCP client and server. It is the same idea as the SSL capture but for stdio: you observe the conversation without either the client or the server knowing. Typical use case: seeing which tools of the &lt;code>filesystem-mcp&lt;/code> MCP server a Claude Code agent has invoked in the last hour, what arguments it passed, what errors it received. Impossible with classic instrumentation (MCP servers are usually third-party binaries).&lt;/p>
&lt;h3 id="guarantees-tamper-proof-kernel-safety-3-overhead">Guarantees: tamper-proof, kernel safety, &amp;lt;3% overhead&lt;/h3>
&lt;p>Three properties make AgentSight interesting for production:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Tamper-proof&lt;/strong>: the observation happens in the kernel (uprobes, syscalls). A malicious or compromised application cannot falsify what is seen. Compare with instrumentation: if the agent decides not to emit the span for its action, it does not appear in Langfuse. Here it has no choice.&lt;/li>
&lt;li>&lt;strong>Kernel safety&lt;/strong>: eBPF formally verifies that programs terminate and respect bounds checks. It cannot crash the kernel. The same as in the rest of the eBPF series.&lt;/li>
&lt;li>&lt;strong>&amp;lt;3% CPU overhead&lt;/strong> measured on real agent workloads (per the paper). The number compares favourably with SDK instrumentation, which typically adds 5-10% in intensive applications.&lt;/li>
&lt;/ul>
&lt;h3 id="what-it-detects-out-of-the-box">What it detects out of the box&lt;/h3>
&lt;p>The paper and the documentation highlight three classes of detection:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Real-time prompt injection&lt;/strong>: the correlation engine can apply rules or a detection model over the plaintext captured by the SSL uprobes. If the prompt contains suspicious patterns, &amp;ldquo;ignore all previous instructions&amp;rdquo;, a system prompt embedded in a user input, instructions to exfiltrate data, it raises an alert.&lt;/li>
&lt;li>&lt;strong>Reasoning loops that burn resources&lt;/strong>: agents that enter infinite loops calling tools without progressing. Detectable because the causal chain does not converge to a &amp;ldquo;final answer&amp;rdquo; and the tokens pile up. The correlation engine flags them.&lt;/li>
&lt;li>&lt;strong>Bottlenecks in multi-agent setups&lt;/strong>: when several agents coordinate, AgentSight sees the communication matrix between all of them and can detect agents that block while waiting, deadlocks, excessive fan-out.&lt;/li>
&lt;/ul>
&lt;h2 id="the-clash-and-the-coexistence">The clash and the coexistence&lt;/h2>
&lt;p>The two families look like competitors, but in reality they see different things and complement each other in production.&lt;/p>
&lt;h3 id="what-only-the-instrumented-one-sees">What only the instrumented one sees&lt;/h3>
&lt;ul>
&lt;li>&lt;strong>Internal agent variables&lt;/strong> that never reach the wire: the intermediate state of a LangChain chain, the values before passing them to a tool, how a prompt is built from a template with internal vars.&lt;/li>
&lt;li>&lt;strong>Deep semantic spans&lt;/strong>: &lt;code>retrieval &amp;gt; embed &amp;gt; vector_search &amp;gt; rerank &amp;gt; format_context &amp;gt; prompt_template &amp;gt; llm&lt;/code>. AgentSight sees only the final call to the LLM; the path taken to build it is invisible.&lt;/li>
&lt;li>&lt;strong>Evaluations&lt;/strong>: scoring of answers, judge LLMs, quality regression. This lives only in instrumented platforms.&lt;/li>
&lt;/ul>
&lt;h3 id="what-only-ebpf-sees">What only eBPF sees&lt;/h3>
&lt;ul>
&lt;li>&lt;strong>Opaque binaries&lt;/strong>: Claude Code, Cursor, Gemini CLI, third-party agents. You do not have the code; you cannot instrument them. Only eBPF sees them.&lt;/li>
&lt;li>&lt;strong>System-level actions&lt;/strong>: the agent decides to run &lt;code>git push --force&lt;/code> or &lt;code>kubectl delete&lt;/code>. The action is seen in the &lt;code>execve&lt;/code>. The agent&amp;rsquo;s instrumentation may not report it (especially if it was a command the agent generated as output without going through an explicit &amp;ldquo;tool&amp;rdquo;).&lt;/li>
&lt;li>&lt;strong>Tamper-proof audit&lt;/strong>: for regulatory compliance (HIPAA, SOC2, NIS2), having observation the app cannot dodge has formal value. eBPF provides it.&lt;/li>
&lt;li>&lt;strong>Local MCP servers over stdio&lt;/strong>: invisible to classic instrumentation unless each server emits its own spans (rare).&lt;/li>
&lt;/ul>
&lt;h3 id="what-both-see-complementarily">What both see, complementarily&lt;/h3>
&lt;ul>
&lt;li>&lt;strong>Prompts and completions&lt;/strong>: the instrumented approach emits them with rich metadata; eBPF captures them off the wire. A perfect cross-check for spotting discrepancies.&lt;/li>
&lt;li>&lt;strong>Calls to external APIs&lt;/strong>: APM flags it; eBPF confirms it at kernel level.&lt;/li>
&lt;li>&lt;strong>Latency&lt;/strong>: APM per span; eBPF measures RTT at TCP level and network connectivity.&lt;/li>
&lt;/ul>
&lt;h3 id="decision-matrix">Decision matrix&lt;/h3>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Case&lt;/th>
&lt;th>Instrumented&lt;/th>
&lt;th>eBPF (AgentSight)&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>Your own app with LangChain&lt;/td>
&lt;td>&lt;strong>Yes, first&lt;/strong>&lt;/td>
&lt;td>Optional&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Your own multi-framework app&lt;/td>
&lt;td>&lt;strong>Yes&lt;/strong>&lt;/td>
&lt;td>Optional&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Third-party binary (Claude Code, Cursor)&lt;/td>
&lt;td>&lt;strong>Does not work&lt;/strong>&lt;/td>
&lt;td>&lt;strong>Yes, the only path&lt;/strong>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Tamper-proof regulatory compliance&lt;/td>
&lt;td>Insufficient&lt;/td>
&lt;td>&lt;strong>Yes, required&lt;/strong>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Zero-trust multi-tenant&lt;/td>
&lt;td>Insufficient&lt;/td>
&lt;td>&lt;strong>Yes, required&lt;/strong>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Local MCP servers (stdio)&lt;/td>
&lt;td>Difficult&lt;/td>
&lt;td>&lt;strong>Yes, with stdiocap&lt;/strong>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Answer quality evaluation&lt;/td>
&lt;td>&lt;strong>Yes, required&lt;/strong>&lt;/td>
&lt;td>No (out of scope)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Depth of the internal chain&lt;/td>
&lt;td>&lt;strong>Yes, required&lt;/strong>&lt;/td>
&lt;td>No (a black box for AgentSight)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Reasoning loop detection&lt;/td>
&lt;td>Possible with plumbing&lt;/td>
&lt;td>&lt;strong>Yes, built in&lt;/strong>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Real-time prompt injection&lt;/td>
&lt;td>Possible (post-processed)&lt;/td>
&lt;td>&lt;strong>Yes, in stream&lt;/strong>&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>The natural conclusion: &lt;strong>for your own apps, instrumented; for opaque binaries or compliance, eBPF; for everything that matters, both&lt;/strong>.&lt;/p>
&lt;h2 id="2026-reference-architecture">2026 reference architecture&lt;/h2>
&lt;p>Four recipes that cover the bulk of real cases:&lt;/p>
&lt;h3 id="setup-a--your-own-application-with-langchain-or-similar">Setup A — Your own application with LangChain or similar&lt;/h3>
&lt;p>Needs: depth, evals, a team comfortable with SDKs.&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Langfuse self-host&lt;/strong> or &lt;strong>LangSmith cloud&lt;/strong> as the backend.&lt;/li>
&lt;li>&lt;strong>OpenLLMetry SDK&lt;/strong> or &lt;strong>LangSmith SDK&lt;/strong> instrumenting the code.&lt;/li>
&lt;li>&lt;strong>OpenTelemetry Collector&lt;/strong> between the app and the backend for routing flexibility (to Langfuse + Tempo + Loki, for instance).&lt;/li>
&lt;li>&lt;strong>Hubble&lt;/strong> for the network layer in the cluster (inter-pod latency, drop attribution).&lt;/li>
&lt;/ul>
&lt;h3 id="setup-b--productionising-an-opaque-binary-claude-code-gemini-cli">Setup B — Productionising an opaque binary (Claude Code, Gemini CLI)&lt;/h3>
&lt;p>Needs: observe without touching, audit, control cost.&lt;/p>
&lt;ul>
&lt;li>&lt;strong>AgentSight&lt;/strong> deployed as a DaemonSet over the cluster (or standalone on the node).&lt;/li>
&lt;li>&lt;strong>Grafana with dashboards&lt;/strong> fed by AgentSight&amp;rsquo;s metrics.&lt;/li>
&lt;li>&lt;strong>An OTLP exporter&lt;/strong> from AgentSight to an OTel backend (Tempo, Jaeger). The spans will use the GenAI semantic conventions once they are fully standardised.&lt;/li>
&lt;li>&lt;strong>Tetragon&lt;/strong> optionally for policy over what the agent is allowed to run (Sigkill if it tries &lt;code>rm -rf&lt;/code> or similar).&lt;/li>
&lt;/ul>
&lt;h3 id="setup-c--zero-trust-multi-tenant-platform">Setup C — Zero-trust multi-tenant platform&lt;/h3>
&lt;p>Needs: agents from different clients running on the same cluster, mandatory audit, nobody trusts anybody.&lt;/p>
&lt;ul>
&lt;li>&lt;strong>AgentSight&lt;/strong> as the tamper-proof audit layer. Compliance requires it.&lt;/li>
&lt;li>&lt;strong>Langfuse multi-tenant&lt;/strong> for the clients that do instrument.&lt;/li>
&lt;li>&lt;strong>Tetragon&lt;/strong> with &lt;code>TracingPolicyNamespaced&lt;/code> per tenant (different policies per namespace).&lt;/li>
&lt;li>&lt;strong>Hubble&lt;/strong> with persistent flow logs for forensics.&lt;/li>
&lt;li>&lt;strong>Cilium NetworkPolicy&lt;/strong> to isolate tenants from each other on the network.&lt;/li>
&lt;/ul>
&lt;h3 id="setup-d--a-local-mcp-server-on-a-workstation">Setup D — A local MCP server on a workstation&lt;/h3>
&lt;p>Needs: seeing what an agent does with a stdio MCP server.&lt;/p>
&lt;ul>
&lt;li>&lt;strong>AgentSight stdiocap&lt;/strong> pointed at the PID of the client or the server.&lt;/li>
&lt;li>Complete JSON-RPC capture to a file or to an OTLP endpoint.&lt;/li>
&lt;li>Visualisation: Grafana, or simply &lt;code>jq&lt;/code> over the log.&lt;/li>
&lt;/ul>
&lt;p>A real use case: if you are integrating an MCP server of your own and want to see what tool calls a Claude Code or Cursor agent makes to your server, &lt;code>stdiocap&lt;/code> is the cleanest way. You need to modify neither client nor server.&lt;/p>
&lt;h2 id="operational-traps">Operational traps&lt;/h2>
&lt;h3 id="sensitive-data-in-prompts-instrumented">Sensitive data in prompts (instrumented)&lt;/h3>
&lt;p>By default, Langfuse, LangSmith and similar tools capture &lt;strong>the complete content&lt;/strong> of prompts and completions. If your app processes PII, secrets or medical data, &lt;strong>that goes to your observability backend&lt;/strong>. Configuring &lt;strong>redaction&lt;/strong> or &lt;strong>content opt-out&lt;/strong> before going to production is mandatory. OTel GenAI has specific flags (&lt;code>OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=false&lt;/code>) to avoid it.&lt;/p>
&lt;h3 id="sensitive-data-in-prompts-agentsight">Sensitive data in prompts (AgentSight)&lt;/h3>
&lt;p>The same problem, worse: AgentSight captures &lt;strong>literally what goes to the wire&lt;/strong>, in plaintext. If the agent talked to &lt;code>api.openai.com&lt;/code> with a prompt containing sensitive data, AgentSight has that plaintext. You have to encrypt or redact before storing.&lt;/p>
&lt;h3 id="pinned-certificates-or-non-standard-tls">Pinned certificates or non-standard TLS&lt;/h3>
&lt;p>Some high-security apps do certificate pinning or use unconventional TLS implementations (Go&amp;rsquo;s &lt;code>crypto/tls&lt;/code>, custom BoringSSL). In those cases, the uprobes on &lt;code>libssl&lt;/code> do not cover them. AgentSight detects when it cannot observe and reports the gap; you still have to add specific hooks for the alternative SDK.&lt;/p>
&lt;h3 id="token-volume-and-storage">Token volume and storage&lt;/h3>
&lt;p>An application with medium traffic can generate &lt;strong>millions of tokens a day&lt;/strong>. If you store them all in Langfuse or Phoenix with long retention, the database grows fast. Strategies: aggressive sampling, short retention for normal sessions and long retention only for errors/anomalies, content redaction and keeping only metadata.&lt;/p>
&lt;h3 id="tracing-with-sampling-and-consistency">Tracing with sampling and consistency&lt;/h3>
&lt;p>To cut cost, many installations sample: only 1 in every N traces is persisted. &lt;strong>Be careful with inconsistent sampling&lt;/strong>: a trace can carry several spans across multiple services, and if the sampling decision is taken per span, you end up with incomplete traces. OTel has &lt;strong>head sampling&lt;/strong> (in the SDK, at the start), which is consistent, and &lt;strong>tail sampling&lt;/strong> (in the collector, at the end), which allows finer rules. For LLM, tail sampling is ideal: sample everything, discard only the &amp;ldquo;normal&amp;rdquo; traces and keep the ones with errors, high latency or high cost.&lt;/p>
&lt;h3 id="multi-agent-and-trace-propagation">Multi-agent and trace propagation&lt;/h3>
&lt;p>When agent A calls agent B, you have to &lt;strong>propagate the trace context&lt;/strong> (W3C Trace Context headers) so it shows up as a single tree. If you do not, you see two disconnected traces. Modern platforms do it automatically with &lt;code>inject&lt;/code>/&lt;code>extract&lt;/code>, but if your transport between agents is custom (over Redis pub/sub, over a DB), you have to propagate by hand.&lt;/p>
&lt;h3 id="the-cost-of-uprobes-on-critical-libraries">The cost of uprobes on critical libraries&lt;/h3>
&lt;p>Hooking &lt;code>libssl&lt;/code> adds around 100 ns per invocation. On extreme TLS traffic loads (tens of thousands of connections/s per core), that adds up. AgentSight keeps it under 3% on typical agent workloads (which are chatty but not networking-intensive). If your use were sniffing all the HTTPS on the node, it could hurt more.&lt;/p>
&lt;h2 id="what-we-have-not-covered-next-series">What we have not covered (next series)&lt;/h2>
&lt;ul>
&lt;li>&lt;strong>Evals&lt;/strong>: the next layer after tracing. Phoenix, Langfuse, LangSmith and company offer answer evaluation (judge LLM, datasets, regression). It is a world of its own.&lt;/li>
&lt;li>&lt;strong>Guardrails and safety&lt;/strong>: NeMo Guardrails, Llama Guard, Llama Prompt Guard, evaluators specific to prompt injection and jailbreaks.&lt;/li>
&lt;li>&lt;strong>Deep MCP server observability&lt;/strong>: how the OpenTelemetry GenAI conventions are being extended to MCP servers for trace-aware tools.&lt;/li>
&lt;li>&lt;strong>eBPF + on-device inference&lt;/strong>: when the LLM runs locally through vLLM or llama.cpp, the uprobes can see the output token queue BEFORE it goes to the client. New territory.&lt;/li>
&lt;li>&lt;strong>Statistical analysis of agent flows&lt;/strong>: detecting drift, outliers, patterns that indicate degradation.&lt;/li>
&lt;/ul>
&lt;h2 id="closing-the-ebpf-series">Closing the eBPF series&lt;/h2>
&lt;p>This series of four articles has travelled eBPF from first principles to the 2026 frontier:&lt;/p>
&lt;ol>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/ebpf-zero-to-cilium-kernel-tcp-ip-bypass/">eBPF from zero to Cilium&lt;/a> — what eBPF is, networking hooks, how Cilium skips the TCP/IP stack, BGP Control Plane v2.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/tetragon-cilium-security-syscalls-kernel/">Tetragon: runtime security&lt;/a> — observability and enforcement of processes in the kernel.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/hubble-ebpf-network-observability-ai-agents/">Hubble: network observability&lt;/a> — L3-L7 flow logs and the frontier with AI agents.&lt;/li>
&lt;li>&lt;strong>This one&lt;/strong> — AgentSight, LLM tracing, instrumented vs zero-instrumentation.&lt;/li>
&lt;/ol>
&lt;p>If you have got this far you have the map to sit down with a platform, security or AI team in 2026 and recognise what each piece does, what problem it solves and where to start. That whole stack, Cilium for CNI and BGP, Tetragon for runtime security, Hubble for network observability, AgentSight for AI agents, sharing eBPF as a common substrate, Cloud Native governance and OpenTelemetry vocabulary. It is the clean architecture the industry asked for a decade ago and that finally exists.&lt;/p>
&lt;h2 id="references">References&lt;/h2>
&lt;p>AgentSight:&lt;/p>
&lt;ul>
&lt;li>&lt;a href="https://github.com/eunomia-bpf/agentsight">AgentSight GitHub (eunomia-bpf)&lt;/a> — the project.&lt;/li>
&lt;li>&lt;a href="https://arxiv.org/abs/2508.02736">AgentSight: System-Level Observability for AI Agents Using eBPF (arxiv 2508.02736)&lt;/a> — the formal paper.&lt;/li>
&lt;li>&lt;a href="https://dl.acm.org/doi/10.1145/3766882.3767169">AgentSight ACM workshop publication&lt;/a>.&lt;/li>
&lt;li>&lt;a href="https://eunomia.dev/blog/2025/08/26/agentsight-keeping-your-ai-agents-under-control-with-ebpf-powered-system-observability/">AgentSight blog post (eunomia.dev)&lt;/a> — accessible description.&lt;/li>
&lt;/ul>
&lt;p>OpenTelemetry GenAI semantic conventions:&lt;/p>
&lt;ul>
&lt;li>&lt;a href="https://opentelemetry.io/docs/specs/semconv/gen-ai/">OpenTelemetry — Semantic conventions for generative AI systems&lt;/a> — official reference.&lt;/li>
&lt;li>&lt;a href="https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-spans/">Semantic conventions for generative client AI spans&lt;/a>.&lt;/li>
&lt;li>&lt;a href="https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-metrics/">Semantic conventions for generative AI metrics&lt;/a>.&lt;/li>
&lt;li>&lt;a href="https://opentelemetry.io/blog/2026/genai-observability/">Inside the LLM Call: GenAI Observability with OpenTelemetry (OTel blog 2026)&lt;/a>.&lt;/li>
&lt;li>&lt;a href="https://github.com/open-telemetry/semantic-conventions/issues/2664">Multi-agent Semantic Conventions (GitHub issue #2664)&lt;/a>.&lt;/li>
&lt;/ul>
&lt;p>Instrumented platforms:&lt;/p>
&lt;ul>
&lt;li>&lt;a href="https://langfuse.com/">Langfuse&lt;/a> — MIT, self-host + cloud.&lt;/li>
&lt;li>&lt;a href="https://www.langchain.com/langsmith">LangSmith&lt;/a> — LangChain team.&lt;/li>
&lt;li>&lt;a href="https://phoenix.arize.com/">Arize Phoenix&lt;/a> — OSS, OTel-native.&lt;/li>
&lt;li>&lt;a href="https://www.helicone.ai/">Helicone&lt;/a> — simple proxy.&lt;/li>
&lt;li>&lt;a href="https://github.com/traceloop/openllmetry">OpenLLMetry (Traceloop)&lt;/a> — Apache 2.0, OTel SDK.&lt;/li>
&lt;li>&lt;a href="https://pydantic.dev/docs/logfire/get-started/ai-observability/">Pydantic Logfire — AI observability&lt;/a>.&lt;/li>
&lt;/ul>
&lt;p>2026 comparisons:&lt;/p>
&lt;ul>
&lt;li>&lt;a href="https://www.braintrust.dev/articles/langfuse-alternatives-2026">Langfuse alternatives 2026 (Braintrust)&lt;/a>.&lt;/li>
&lt;li>&lt;a href="https://www.braintrust.dev/articles/best-llm-tracing-tools-2026">7 best LLM tracing tools for multi-agent AI systems (2026)&lt;/a>.&lt;/li>
&lt;li>&lt;a href="https://medium.com/@kanerika/llmops-observability-langsmith-vs-arize-vs-langfuse-vs-w-b-f1baeabd1bbf">LLMOps Observability: LangSmith vs Arize vs Langfuse vs W&amp;amp;B&lt;/a>.&lt;/li>
&lt;li>&lt;a href="https://www.firecrawl.dev/blog/best-llm-observability-tools">Best LLM Observability Tools in 2026 (Firecrawl)&lt;/a>.&lt;/li>
&lt;li>&lt;a href="https://www.spheron.network/blog/llm-observability-gpu-cloud-langfuse-arize-phoenix-helicone/">LLM Observability on GPU Cloud (Spheron 2026 guide)&lt;/a>.&lt;/li>
&lt;/ul>
&lt;p>Cross-references from the series:&lt;/p>
&lt;ul>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/ebpf-zero-to-cilium-kernel-tcp-ip-bypass/">eBPF from zero to Cilium&lt;/a>.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/tetragon-cilium-security-syscalls-kernel/">Tetragon: runtime security&lt;/a>.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/hubble-ebpf-network-observability-ai-agents/">Hubble: network observability&lt;/a>.&lt;/li>
&lt;li>LLM inference series: &lt;a href="https://blog.lo0.es/en/posts/kv-cache-working-memory-llm-inference/">KV cache&lt;/a>, &lt;a href="https://blog.lo0.es/en/posts/vllm-kubernetes-llm-inference-that-scales/">vLLM on Kubernetes&lt;/a>, &lt;a href="https://blog.lo0.es/en/posts/pagedattention-vllm-block-manager/">PagedAttention&lt;/a>, &lt;a href="https://blog.lo0.es/en/posts/llm-inference-operators-kubernetes/">LLM Operators on K8s&lt;/a>.&lt;/li>
&lt;/ul></description></item><item><title>Hubble: eBPF network observability, state of the art 2026 and the new frontier with AI agents</title><link>https://blog.lo0.es/en/posts/hubble-ebpf-network-observability-ai-agents/</link><pubDate>Tue, 19 May 2026 06:00:00 +0200</pubDate><guid>https://blog.lo0.es/en/posts/hubble-ebpf-network-observability-ai-agents/</guid><description>&lt;h2 id="tldr">TL;DR&lt;/h2>
&lt;p>&lt;a href="https://github.com/cilium/hubble">Hubble&lt;/a> is &lt;strong>Cilium&amp;rsquo;s native network observability&lt;/strong>, built on the same eBPF programs Cilium uses for enforcement. It does not duplicate the datapath or instrument the kernel its own way: it &lt;strong>listens&lt;/strong> to the hooks Cilium already has and produces structured flow logs with Kubernetes context included, covering pod, namespace, labels, service, policy verdict and L7 payload where applicable. It is what happens when someone decides that &lt;code>tcpdump&lt;/code> with &lt;code>grep&lt;/code> does not scale to 10,000 pods and builds a distributed system of their own (a Hubble server per node, plus Hubble Relay as the aggregator, plus a CLI and a UI) with practically zero overhead, because the capture was already happening. In 2026 it is at version 1.19.3 (April 2026), with Cilium 1.19 marking the project&amp;rsquo;s tenth anniversary; IP options tracing has arrived, along with filtering by encryption status, the drop event tagged with the exact NetworkPolicy that caused it (direct attribution), a stabilised field mask API, and the first wave of ML anomaly detection applied to flows for predictive security in IoT/5G clusters. And, most interesting of all for 2026: a new frontier appears where the same eBPF observes AI agents such as Claude Code, Gemini CLI and MCP agents, intercepting SSL/TLS and stdio without instrumenting the code, which turns the Cilium + Hubble + Tetragon + AgentSight stack into a complete set of tools for understanding what an agentic system does inside a cluster.&lt;/p>
&lt;blockquote>
&lt;p>This article is part 3 of the eBPF series. Part 1: &lt;a href="https://blog.lo0.es/en/posts/ebpf-zero-to-cilium-kernel-tcp-ip-bypass/">eBPF from zero to Cilium: how the kernel learned to skip its own TCP/IP stack&lt;/a>. Part 2: &lt;a href="https://blog.lo0.es/en/posts/tetragon-cilium-security-syscalls-kernel/">Tetragon: Cilium&amp;rsquo;s security cousin that sees every syscall in the kernel&lt;/a>. Here we complete the observability quadrant: network with Hubble, process with Tetragon, AI agent with AgentSight.&lt;/p>
&lt;/blockquote>
&lt;h2 id="the-analogy-tcpdump-that-speaks-kubernetes">The analogy: tcpdump that speaks Kubernetes&lt;/h2>
&lt;p>If you have administered networks over the last twenty years, &lt;code>tcpdump&lt;/code> and Wireshark have been your daily bread. They capture packets on an interface, parse them, and let you filter with &lt;code>tcp.port == 443 and host 10.0.0.5&lt;/code>. They work, they have been working since the 90s, and they are the first thing you open when something smells wrong.&lt;/p>
&lt;p>Now stick &lt;code>tcpdump&lt;/code> on a Kubernetes cluster with 10,000 pods. The problems show up in order:&lt;/p>
&lt;ol>
&lt;li>&lt;strong>One &lt;code>tcpdump&lt;/code> session per node&lt;/strong>. You wanted to &amp;ldquo;see the traffic between the frontend and the API&amp;rdquo;; you need SSH to every node, tcpdump on every NIC, synchronised timestamps, manual aggregation.&lt;/li>
&lt;li>&lt;strong>There is no K8s context&lt;/strong>. You see a packet from &lt;code>10.244.5.7&lt;/code> to &lt;code>10.244.8.42&lt;/code>. Which pod was that? Which namespace? Which label? You have to correlate with &lt;code>kubectl get pod -A -o wide&lt;/code> every single time.&lt;/li>
&lt;li>&lt;strong>No L7 understanding&lt;/strong>. You see a POST to HTTPS, and you cannot know the method and path because it is encrypted on the wire. If there is mTLS between pods, worse.&lt;/li>
&lt;li>&lt;strong>High cost&lt;/strong>: full packet capture with a copy to userspace slows down the datapath. Under dense traffic, you notice it.&lt;/li>
&lt;/ol>
&lt;p>Hubble is &lt;strong>tcpdump redesigned for all of that&lt;/strong>. It reuses the eBPF programs that are already processing every packet (Cilium puts them there for enforcement) and, while they take their allow/deny decision, they emit a flow event with all the context: source and destination pod identity, namespace, labels, protocol, verdict, and, if Cilium has done L7 parsing via Envoy, the HTTP method, path, status code, DNS query, Kafka topic. That event travels through a ringbuffer to userspace, it is received by the Hubble server that lives inside the node&amp;rsquo;s Cilium agent, and it is exposed over gRPC. A separate service, Hubble Relay, aggregates the streams from all nodes and gives you a single cluster-wide API. On top of that: a CLI (&lt;code>hubble&lt;/code>) and a web UI with a real-time service graph.&lt;/p>
&lt;p>Zero additional copies. Zero duplicated parsing. And the result is understandable by anyone who knows what a Pod is.&lt;/p>
&lt;h2 id="architecture-four-pieces-visible-from-outside">Architecture: four pieces visible from outside&lt;/h2>
&lt;p>Hubble is made up of four logical components, all optional depending on what you want to do:&lt;/p>
&lt;h3 id="1-hubble-server-embedded-in-every-cilium-agent">1. Hubble Server (embedded in every Cilium agent)&lt;/h3>
&lt;p>It lives inside the Cilium agent process (it is not a separate binary). Each node exposes a gRPC endpoint locally on the Unix socket &lt;code>/var/run/cilium/hubble.sock&lt;/code>. The server listens to the events the eBPF programs emit to the ringbuffer, enriches them with Kubernetes metadata (which the agent already has in memory), and makes them available to consumers.&lt;/p>
&lt;p>Enabling it: &lt;code>--set hubble.enabled=true&lt;/code> in Cilium&amp;rsquo;s Helm chart. By default, the server is only accessible locally; if you want to consume it from another node, it has to be exposed (which is what Hubble Relay does).&lt;/p>
&lt;h3 id="2-hubble-relay-aggregator">2. Hubble Relay (aggregator)&lt;/h3>
&lt;p>It is a separate Deployment (typically 1 replica, scalable) that connects to every Hubble server in the cluster and aggregates their streams into a single API. When your CLI or UI asks for &amp;ldquo;the last 1000 flows in the cluster&amp;rdquo;, the Relay collects them in parallel from all nodes and returns the union.&lt;/p>
&lt;p>Enabling it: &lt;code>--set hubble.relay.enabled=true&lt;/code>. Without the Relay you only see the traffic of the node you are connected to, which is useful for local debugging but not for a cluster-wide view.&lt;/p>
&lt;h3 id="3-hubble-cli-hubble">3. Hubble CLI (&lt;code>hubble&lt;/code>)&lt;/h3>
&lt;p>A Go binary that speaks gRPC with the Relay (or with a local Hubble server). It supports two main modes:&lt;/p>
&lt;ul>
&lt;li>&lt;code>hubble observe&lt;/code>: a real-time stream of flows, with very expressive filters (by namespace, pod, port, verdict, protocol, label).&lt;/li>
&lt;li>&lt;code>hubble status&lt;/code>: the state of the Hubble cluster (how many nodes connected, lag, flow rate).&lt;/li>
&lt;/ul>
&lt;p>And the equivalent of &lt;code>tcpdump&lt;/code>&amp;rsquo;s pcap dump: &lt;code>hubble observe --output jsonpb &amp;gt; flows.json&lt;/code> to process afterwards with &lt;code>jq&lt;/code> or other tools.&lt;/p>
&lt;h3 id="4-hubble-ui">4. Hubble UI&lt;/h3>
&lt;p>A web frontend that connects to Hubble Relay and shows:&lt;/p>
&lt;ul>
&lt;li>A service graph in real time (which Pod talks to which Service, which protocols it uses, which verdict).&lt;/li>
&lt;li>A filterable list of flows.&lt;/li>
&lt;li>&lt;strong>L7 details&lt;/strong> where there are any (HTTP method/path/status, DNS query/response).&lt;/li>
&lt;/ul>
&lt;p>Enabling it: &lt;code>--set hubble.ui.enabled=true&lt;/code>. Useful for presentations to non-CLI teams; it does not replace the CLI for serious debugging.&lt;/p>
&lt;div class="diagram" style="max-width:720px;margin:1.5rem auto;">
&lt;svg viewBox="0 0 720 290" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Hubble architecture">
&lt;style>.title{font:600 13px sans-serif;fill:#222}.lbl{font:600 12px sans-serif;fill:#222}.sm{font:11px sans-serif;fill:#555}.box{stroke:#444;stroke-width:1.4}.k{fill:#ffe9d6}.s{fill:#d6eaff}.r{fill:#d9f5d6}.c{fill:#e9d6f5}.arr{stroke:#666;stroke-width:1.4;fill:none;marker-end:url(#hh)}&lt;/style>
&lt;defs>&lt;marker id="hh" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6" markerHeight="6" orient="auto">&lt;path d="M0,0 L10,5 L0,10 z" fill="#666"/>&lt;/marker>&lt;/defs>
&lt;text x="360" y="18" text-anchor="middle" class="title">Hubble architecture: 4 pieces, eBPF as the only data source&lt;/text>
&lt;rect x="30" y="40" width="200" height="50" rx="6" class="box k"/>
&lt;text x="130" y="60" text-anchor="middle" class="lbl">eBPF (kernel)&lt;/text>
&lt;text x="130" y="78" text-anchor="middle" class="sm">Cilium programs&lt;/text>
&lt;rect x="30" y="115" width="200" height="50" rx="6" class="box s"/>
&lt;text x="130" y="135" text-anchor="middle" class="lbl">Hubble Server (node)&lt;/text>
&lt;text x="130" y="153" text-anchor="middle" class="sm">local grpc, inside the agent&lt;/text>
&lt;rect x="270" y="115" width="180" height="50" rx="6" class="box s"/>
&lt;text x="360" y="135" text-anchor="middle" class="lbl">Hubble Server (node N)&lt;/text>
&lt;text x="360" y="153" text-anchor="middle" class="sm">one per node&lt;/text>
&lt;rect x="490" y="115" width="200" height="50" rx="6" class="box s"/>
&lt;text x="590" y="135" text-anchor="middle" class="lbl">Hubble Server (node …)&lt;/text>
&lt;text x="590" y="153" text-anchor="middle" class="sm">N agents = N servers&lt;/text>
&lt;rect x="220" y="190" width="280" height="50" rx="6" class="box r"/>
&lt;text x="360" y="210" text-anchor="middle" class="lbl">Hubble Relay (Deployment)&lt;/text>
&lt;text x="360" y="228" text-anchor="middle" class="sm">aggregates gRPC streams from all nodes&lt;/text>
&lt;rect x="80" y="245" width="160" height="35" rx="6" class="box c"/>
&lt;text x="160" y="266" text-anchor="middle" class="lbl">Hubble CLI&lt;/text>
&lt;rect x="290" y="245" width="160" height="35" rx="6" class="box c"/>
&lt;text x="370" y="266" text-anchor="middle" class="lbl">Hubble UI&lt;/text>
&lt;rect x="500" y="245" width="180" height="35" rx="6" class="box c"/>
&lt;text x="590" y="266" text-anchor="middle" class="lbl">Prometheus / OTLP&lt;/text>
&lt;path class="arr" d="M130,90 L130,115"/>
&lt;path class="arr" d="M130,165 L290,190"/>
&lt;path class="arr" d="M360,165 L360,190"/>
&lt;path class="arr" d="M590,165 L430,190"/>
&lt;path class="arr" d="M340,240 L200,245"/>
&lt;path class="arr" d="M360,240 L370,245"/>
&lt;path class="arr" d="M380,240 L560,245"/>
&lt;/svg>
&lt;/div>
&lt;h2 id="what-you-see-the-hubble-flow-log-from-the-inside">What you see: the Hubble flow log from the inside&lt;/h2>
&lt;p>A Hubble flow in JSON format looks roughly like this (simplified):&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-json" data-lang="json">&lt;span class="line">&lt;span class="cl">&lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;time&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;2026-05-19T03:12:45.182Z&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;verdict&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;FORWARDED&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;source&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;ID&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="mi">5482&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;identity&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="mi">24871&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;namespace&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;prod-api&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;labels&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;app=checkout&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="s2">&amp;#34;team=payments&amp;#34;&lt;/span>&lt;span class="p">],&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;pod_name&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;checkout-7c9f-x8j2&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;workloads&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[{&lt;/span>&lt;span class="nt">&amp;#34;name&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;checkout&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="nt">&amp;#34;kind&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;Deployment&amp;#34;&lt;/span>&lt;span class="p">}]&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">},&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;destination&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;ID&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="mi">12041&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;identity&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="mi">18356&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;namespace&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;prod-db&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;labels&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;app=postgres&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="s2">&amp;#34;tier=primary&amp;#34;&lt;/span>&lt;span class="p">],&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;pod_name&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;postgres-0&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">},&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;Type&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;L3_L4&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;l4&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;TCP&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;source_port&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="mi">41982&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;destination_port&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="mi">5432&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;flags&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">{&lt;/span>&lt;span class="nt">&amp;#34;SYN&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="kc">true&lt;/span>&lt;span class="p">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">},&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;node_name&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;rke2-worker-03&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;Summary&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;TCP Flags: SYN&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="p">}&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>When L7 parsing is active (via embedded Envoy or Hubble&amp;rsquo;s lightweight parser), the same flow adds:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-json" data-lang="json">&lt;span class="line">&lt;span class="cl">&lt;span class="s2">&amp;#34;l7&amp;#34;&lt;/span>&lt;span class="err">:&lt;/span> &lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;type&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;REQUEST&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;http&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;code&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="mi">200&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;method&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;GET&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;url&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;/api/v1/cart/items&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;protocol&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;HTTP/1.1&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;headers&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[{&lt;/span>&lt;span class="nt">&amp;#34;key&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;user-agent&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="nt">&amp;#34;value&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;checkout/1.4.2&amp;#34;&lt;/span>&lt;span class="p">}]&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="p">}&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The protocols natively supported for L7 parsing:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>HTTP/1.1 and HTTP/2&lt;/strong> (including gRPC over HTTP/2).&lt;/li>
&lt;li>&lt;strong>DNS&lt;/strong> (queries and responses, with domains, types, response codes).&lt;/li>
&lt;li>&lt;strong>Kafka&lt;/strong> (topics, API keys).&lt;/li>
&lt;li>&lt;strong>TLS handshake&lt;/strong> (SNI, not the encrypted payload by default).&lt;/li>
&lt;li>&lt;strong>MySQL, Cassandra&lt;/strong> (with optional modules).&lt;/li>
&lt;/ul>
&lt;p>For HTTP and gRPC, Cilium can enable the embedded Envoy proxy for the flows you want to inspect (not all of them; it is selective via &lt;code>CiliumNetworkPolicy&lt;/code> with L7 rules). Without Envoy there is lightweight parsing, but less detailed.&lt;/p>
&lt;h2 id="verdict-and-drop-attribution">Verdict and drop attribution&lt;/h2>
&lt;p>Every flow has a &lt;code>verdict&lt;/code>: &lt;code>FORWARDED&lt;/code>, &lt;code>DROPPED&lt;/code>, &lt;code>ERROR&lt;/code>, &lt;code>AUDIT&lt;/code>, &lt;code>REDIRECTED&lt;/code>, &lt;code>TRACED&lt;/code>, &lt;code>TRANSLATED&lt;/code>. For the &lt;code>DROPPED&lt;/code> case, Hubble includes a structured reason (&lt;code>drop_reason&lt;/code>) and, since Cilium 1.19, &lt;strong>the exact NetworkPolicy&lt;/strong> that caused it.&lt;/p>
&lt;p>That last point changes day-to-day operations. Before, when a pod could not talk to another one, the debug flow was:&lt;/p>
&lt;ol>
&lt;li>See the dropped flow in Hubble.&lt;/li>
&lt;li>Look at every CiliumNetworkPolicy in the namespace.&lt;/li>
&lt;li>Reason manually about which one, with which labels, is blocking it.&lt;/li>
&lt;/ol>
&lt;p>With Cilium 1.19&amp;rsquo;s attribution, the &lt;code>policy_match_info&lt;/code> field tells you directly &amp;ldquo;it was dropped by the &lt;code>frontend-egress&lt;/code> policy, rule 3&amp;rdquo;. You go from &amp;ldquo;Sherlock Holmes for 20 minutes&amp;rdquo; to &amp;ldquo;kubectl get -o yaml of that specific policy&amp;rdquo;.&lt;/p>
&lt;h2 id="prometheus-metrics-and-grafana-dashboards">Prometheus metrics and Grafana dashboards&lt;/h2>
&lt;p>Hubble also exposes aggregated metrics in Prometheus format, separate from the gRPC flow stream. Enabling it: &lt;code>--set hubble.metrics.enabled=true&lt;/code> (Helm) plus a list of the set you want to export.&lt;/p>
&lt;p>The usual metric groups:&lt;/p>
&lt;ul>
&lt;li>&lt;code>flow&lt;/code>: total flows by verdict, source/dest, protocol.&lt;/li>
&lt;li>&lt;code>http&lt;/code>: requests by method, response code, latency (histogram).&lt;/li>
&lt;li>&lt;code>dns&lt;/code>: queries, response codes, top-N domains.&lt;/li>
&lt;li>&lt;code>tcp&lt;/code>: handshakes, retransmissions, congestion window.&lt;/li>
&lt;li>&lt;code>drop&lt;/code>: drops by reason, with NetworkPolicy attribution.&lt;/li>
&lt;li>&lt;code>port-distribution&lt;/code>: histogram of active ports.&lt;/li>
&lt;li>&lt;code>policy&lt;/code>: hits by policy and verdict.&lt;/li>
&lt;/ul>
&lt;p>These metrics have rich K8s labels (&lt;code>source_workload&lt;/code>, &lt;code>destination_workload&lt;/code>, &lt;code>namespace&lt;/code>, and so on) that make them pivotable in Grafana. There are &lt;a href="https://grafana.com/grafana/dashboards/?search=hubble">prebuilt dashboards on Grafana Labs&lt;/a> covering the common cases; importing one and having immediate visibility costs five minutes.&lt;/p>
&lt;p>Cost: metrics with many K8s labels can &lt;strong>blow up cardinality&lt;/strong> in Prometheus. For large clusters (&amp;gt;1,000 pods), it is worth reviewing which set you export and using drop rules in Prometheus to keep a lid on it.&lt;/p>
&lt;h2 id="deployment-helm-on-one-screen">Deployment: Helm on one screen&lt;/h2>
&lt;p>The canonical Cilium install with full Hubble:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-yaml" data-lang="yaml">&lt;span class="line">&lt;span class="cl">&lt;span class="c"># values.yaml&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">hubble&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">enabled&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="kc">true&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">metrics&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">enabled&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="l">dns:query;ignoreAAAA&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="l">drop&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="l">tcp&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="l">flow&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="l">port-distribution&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="l">icmp&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="l">httpV2:exemplars=true;labelsContext=source_ip,source_namespace,source_workload,destination_ip,destination_namespace,destination_workload,traffic_direction&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">serviceMonitor&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">enabled&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="kc">true&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c"># auto-discovered by kube-prometheus-stack&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">relay&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">enabled&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="kc">true&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">rollOutPods&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="kc">true&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">ui&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">enabled&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="kc">true&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">rollOutPods&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="kc">true&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">ingress&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">enabled&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="kc">true&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">className&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">cilium&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">hosts&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="l">hubble.example.local&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>And the install itself:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">helm upgrade --install cilium cilium/cilium -n kube-system -f values.yaml
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>After installing, validate with &lt;code>cilium status&lt;/code> (the Cilium CLI) that the Hubble section shows OK, and try your first flow with:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">cilium hubble observe --namespace prod-api --pod checkout-7c9f-x8j2
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="state-of-the-art-in-2026">State of the art in 2026&lt;/h2>
&lt;p>&lt;a href="https://www.infoq.com/news/2026/02/cilium-119/">Cilium 1.19 was released in February 2026&lt;/a>, marking the project&amp;rsquo;s tenth anniversary. Hubble reached version 1.19.3 on 22 April 2026. The relevant news:&lt;/p>
&lt;h3 id="direct-attribution-of-drops-to-a-networkpolicy">Direct attribution of drops to a NetworkPolicy&lt;/h3>
&lt;p>Already covered above; it is probably the most valuable operational change in the release. Any dropped flow carries the name, namespace and specific rule of the policy responsible. It is also available via Prometheus metrics, which allows alerts of the form &amp;ldquo;policy X is dropping &amp;gt;N requests/second&amp;rdquo;.&lt;/p>
&lt;h3 id="tracing-with-ip-options">Tracing with IP options&lt;/h3>
&lt;p>Hubble can now trace individual packets with IP options enabled. It is a mechanism similar to traceroute, but at L3: you put a mark on the packet and Cilium reports it every time the packet crosses a node or an eBPF decision. Useful for debugging multi-cluster paths, fabric mesh, or NetworkPolicies applied at different layers.&lt;/p>
&lt;h3 id="filtering-by-encryption-status">Filtering by encryption status&lt;/h3>
&lt;p>A new CLI flag: &lt;code>hubble observe --encryption-status=encrypted&lt;/code> (or &lt;code>unencrypted&lt;/code>). Useful for validating deployments with WireGuard or IPsec enabled pod-to-pod: you confirm that the traffic that &lt;strong>should&lt;/strong> be encrypted is, and you spot regressions quickly.&lt;/p>
&lt;h3 id="hubble-field-mask-api-stabilised">Hubble field mask API stabilised&lt;/h3>
&lt;p>The &lt;code>field_mask&lt;/code> lets you ask for only the parts of the flow you care about, hugely reducing bandwidth and processing when all you need is, say, source/dest and verdict. It used to be experimental; now it is stable and it is default-on in the CLI.&lt;/p>
&lt;h3 id="ai-driven-anomaly-detection-predictive-security">AI-driven anomaly detection (predictive security)&lt;/h3>
&lt;p>This is the most talked-about addition of 2026. Cilium 1.19 adds hooks so that an external consumer, typically an ML system, can process flows in streaming and detect statistical anomalies: pods that suddenly talk to new destinations, latency spikes on an API, odd DNS sequences. The detection part happens outside the Cilium agent (nobody wants heavy ML in the datapath), but Cilium exposes the flows with the pre-computed features the model needs. The published use cases focus on IoT and 5G, where traffic is high in volume and low in variety, ideal conditions for anomaly detection.&lt;/p>
&lt;h3 id="scaling-to-10000-pods">Scaling to 10,000+ pods&lt;/h3>
&lt;p>Cilium 1.19 has done serious work on scalability: Hubble Relay can now aggregate streams from hundreds of nodes without saturating; the default field_mask reduces inter-node bandwidth; and flows can be sampled under high load if your use is statistical analysis rather than forensic debugging.&lt;/p>
&lt;h3 id="cilium-120-in-development">Cilium 1.20 in development&lt;/h3>
&lt;p>&lt;a href="https://docs.cilium.io/en/latest/operations/upgrade/">Cilium 1.20&lt;/a> is in the development branch. The most relevant bits for Hubble:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Unification of &lt;code>preferIpv6&lt;/code>&lt;/strong>: the &lt;code>hubble.preferIpv6&lt;/code> flag was deprecated in favour of the global &lt;code>preferIpv6&lt;/code> that applies to every Cilium component.&lt;/li>
&lt;li>&lt;strong>&lt;code>tetragon-python&lt;/code> SDK&lt;/strong>: although it belongs to Tetragon, not Hubble, it sets a trend, namely eBPF policies written in Python instead of YAML. Hubble will probably follow a similar path.&lt;/li>
&lt;/ul>
&lt;h2 id="the-new-frontier-ebpf-and-ai-agents">The new frontier: eBPF and AI agents&lt;/h2>
&lt;p>So far, the classic Hubble content. But there is a 2026 twist worth covering, because it closes the loop with the other series on this blog.&lt;/p>
&lt;p>When a Kubernetes cluster starts running AI agents, such as Claude Code, Gemini CLI, or LangGraph-based agents calling APIs and MCP servers, the observability problem changes shape. It is no longer enough to know &amp;ldquo;which pod talked to which pod&amp;rdquo; (that is Hubble) or &amp;ldquo;which process ran what&amp;rdquo; (that is Tetragon). You need to know:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Which external APIs the agent is calling&lt;/strong> and with which prompts.&lt;/li>
&lt;li>&lt;strong>Which MCP tools it is invoking&lt;/strong>, with which arguments.&lt;/li>
&lt;li>&lt;strong>How many tokens it consumes&lt;/strong>, which model it picks, how much it costs.&lt;/li>
&lt;li>&lt;strong>Whether the agent drifts&lt;/strong> from expected behaviour (out-of-policy queries, jailbreak attempts, secret leakage).&lt;/li>
&lt;/ul>
&lt;p>The traditional solutions, instrumenting the agent&amp;rsquo;s code with OpenTelemetry or parsing structured logs, do not work well when the agent is a third-party binary (Anthropic&amp;rsquo;s Claude Code, Google&amp;rsquo;s Gemini CLI) or when the MCP servers live in other languages with stdio as their transport.&lt;/p>
&lt;h3 id="agentsight-zero-instrumentation-for-llm-agents">AgentSight: zero-instrumentation for LLM agents&lt;/h3>
&lt;p>&lt;a href="https://github.com/eunomia-bpf/agentsight">AgentSight&lt;/a> (a project from the &lt;code>eunomia-bpf&lt;/code> group, the same ecosystem behind several high-profile eBPF runtimes) attacks this problem with the same philosophy as Hubble: do not instrument; listen. It puts eBPF hooks at two critical points:&lt;/p>
&lt;ol>
&lt;li>
&lt;p>&lt;strong>uprobes on SSL/TLS libraries&lt;/strong> (&lt;code>libssl&lt;/code>, &lt;code>boringssl&lt;/code>, &lt;code>rustls&lt;/code>). It captures the plaintext before encryption on send and after decryption on recv. For an HTTP call to &lt;code>https://api.anthropic.com/v1/messages&lt;/code>, AgentSight sees the full JSON of the prompt and the response without decrypting anything in transit, simply because it has reached the syscall level before the TLS layer does its work.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>&lt;code>stdiocap&lt;/code> BPF&lt;/strong>: it captures &lt;code>read&lt;/code>, &lt;code>write&lt;/code> and &lt;code>dup&lt;/code> on a process&amp;rsquo;s stdin/stdout/stderr file descriptors. This is what makes it possible to observe MCP servers that speak stdio with their client, the usual pattern for local MCP servers. You capture the JSON-RPC going back and forth without either the client or the server knowing.&lt;/p>
&lt;/li>
&lt;/ol>
&lt;p>Reported overhead: &amp;lt;3% CPU, comparable to Hubble in its own regime.&lt;/p>
&lt;h3 id="how-it-fits-with-hubble-and-tetragon">How it fits with Hubble and Tetragon&lt;/h3>
&lt;p>The three complement each other cleanly:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Hubble&lt;/strong> tells you: &amp;ldquo;the agent&amp;rsquo;s pod opened a TCP connection to &lt;code>api.anthropic.com:443&lt;/code> with verdict ALLOW&amp;rdquo;.&lt;/li>
&lt;li>&lt;strong>Tetragon&lt;/strong> tells you: &amp;ldquo;the &lt;code>claude-code&lt;/code> process with PID 1843 did a &lt;code>connect()&lt;/code> to that IP&amp;rdquo; (plus the binary, the arguments, the pod namespace).&lt;/li>
&lt;li>&lt;strong>AgentSight&lt;/strong> tells you: &amp;ldquo;the HTTPS content of that connection was a prompt &lt;code>messages=[{role:'user', content:'analyze this repo and modify the firewall config'}]&lt;/code> and the response included a tool call to &lt;code>read_file&lt;/code> with argument &lt;code>/etc/passwd&lt;/code>&amp;rdquo;.&lt;/li>
&lt;/ul>
&lt;p>It is the difference between flow, process and semantics. For a security team that wants to watch AI agents in production, all three are necessary. For anyone who wants to understand cost, all three are useful (Hubble for network latency, Tetragon for resource usage, AgentSight for tokens and chosen model).&lt;/p>
&lt;h3 id="emerging-use-cases">Emerging use cases&lt;/h3>
&lt;p>The patterns consolidating in 2026:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Agent audit trail&lt;/strong>: recording every LLM call and every tool call for compliance, especially in regulated sectors.&lt;/li>
&lt;li>&lt;strong>Jailbreak and prompt injection detection&lt;/strong>: applying rules over the prompts captured by AgentSight (similar to Tetragon&amp;rsquo;s TracingPolicy, but over semantic content).&lt;/li>
&lt;li>&lt;strong>Cost accountability&lt;/strong>: seeing which team/agent consumes which tokens, without instrumenting.&lt;/li>
&lt;li>&lt;strong>Replay and debugging&lt;/strong>: reproducing an agent&amp;rsquo;s reasoning in production without asking it to run again (which is non-deterministic).&lt;/li>
&lt;/ul>
&lt;p>It is a young field, AgentSight is months old rather than years, but the &amp;ldquo;eBPF as zero-instrumentation observability&amp;rdquo; pattern is very clearly spreading beyond network and process. The coming year will see consolidation and, probably, native integration with Hubble.&lt;/p>
&lt;h2 id="common-hubble-use-cases">Common Hubble use cases&lt;/h2>
&lt;p>Back to Hubble proper, the cases in which any organisation deploys it:&lt;/p>
&lt;h3 id="1-networkpolicy-debugging">1. NetworkPolicy debugging&lt;/h3>
&lt;p>The classic use: &amp;ldquo;this pod cannot reach this Service&amp;rdquo;. Without Hubble, it meant SSH, tcpdump, comparing rules. With Hubble:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">hubble observe --from-pod prod-api/checkout --to-pod prod-db/postgres --verdict DROPPED
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>If there are drops, you see the policy responsible (Cilium 1.19+). If there are no drops, the problem is not policy: it is DNS, routing or the target service.&lt;/p>
&lt;h3 id="2-auditing-inter-namespace-communication">2. Auditing inter-namespace communication&lt;/h3>
&lt;p>For compliance: validating that isolated namespaces are not communicating against what was declared.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">hubble observe --from-namespace prod-payments --to-namespace &lt;span class="s1">&amp;#39;NOT prod-db&amp;#39;&lt;/span> --output json
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="3-exfiltration-detection">3. Exfiltration detection&lt;/h3>
&lt;p>Outbound traffic to suspicious public destinations. Hubble detects them by IP/SNI, not by payload (which is encrypted):&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">hubble observe --to-fqdn &lt;span class="s1">&amp;#39;NOT *.example.com&amp;#39;&lt;/span> --to-fqdn &lt;span class="s1">&amp;#39;NOT *.internal&amp;#39;&lt;/span> --protocol tcp
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Combined with Prometheus metrics and Grafana alerts, this gives you an exfiltration radar at zero cost.&lt;/p>
&lt;h3 id="4-real-time-service-slos">4. Real-time service SLOs&lt;/h3>
&lt;p>The &lt;code>hubble:http:response_time_seconds&lt;/code> metrics with &lt;code>source_workload&lt;/code>, &lt;code>destination_workload&lt;/code>, &lt;code>method&lt;/code> and &lt;code>status_code&lt;/code> labels allow SLO dashboards without needing to instrument the apps. The SRE sees the p95 latency of &lt;code>checkout → catalog&lt;/code> directly.&lt;/p>
&lt;h3 id="5-performance-debugging">5. Performance debugging&lt;/h3>
&lt;p>&lt;code>hubble:tcp:retransmissions_total&lt;/code> and &lt;code>hubble:tcp:flags_total{flag=&amp;quot;RST&amp;quot;}&lt;/code> are early signals of network problems. A rise correlated with a latency regression points you at something in the infrastructure (NIC, switch, MTU) before you go down to investigate the app.&lt;/p>
&lt;h3 id="6-post-incident-forensics">6. Post-incident forensics&lt;/h3>
&lt;p>Configuring Hubble to export flows to persistent storage (via OTLP to Tempo/Loki, or &lt;code>hubble observe --output jsonpb&lt;/code> to S3) gives you forensic capability: if at T+30 days you detect that something was wrong at T, you can reconstruct the traffic.&lt;/p>
&lt;h2 id="hubble-and-the-rest-of-the-observability-stack">Hubble and the rest of the observability stack&lt;/h2>
&lt;p>Hubble does not replace Prometheus, Loki, Tempo or Jaeger; it complements them:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Prometheus&lt;/strong>: receives Hubble&amp;rsquo;s aggregated metrics. Hubble exports a native Prometheus endpoint.&lt;/li>
&lt;li>&lt;strong>Loki&lt;/strong>: receives the structured flow logs if you export them as logs. Hubble has no native Loki exporter, but a Fluent Bit with an OTLP plugin or a custom one bridges it easily.&lt;/li>
&lt;li>&lt;strong>Tempo / Jaeger&lt;/strong>: the Cilium Operator has an OTLP exporter of flows in trace format (each HTTP/gRPC flow is a span). It integrates with Tempo or any other OTLP tracing backend.&lt;/li>
&lt;li>&lt;strong>Grafana&lt;/strong>: there are already public Hubble dashboards. Combined with Prometheus, Loki and Tempo, they give you a unified panel: metrics, logs, traces, all correlated by K8s labels.&lt;/li>
&lt;/ul>
&lt;p>The full-stack pile seen in production in 2026 (described in &lt;a href="https://dev.to/x4nent/building-a-production-ebpf-observability-security-stack-for-kubernetes-in-2026-5051">Building a Production eBPF Observability &amp;amp; Security Stack for Kubernetes in 2026&lt;/a>):&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Data&lt;/strong>: Cilium + Hubble (network), Tetragon (process), AgentSight (AI agent).&lt;/li>
&lt;li>&lt;strong>Pipeline&lt;/strong>: OTLP Collector as the single router.&lt;/li>
&lt;li>&lt;strong>Storage&lt;/strong>: Prometheus (metrics), Loki (logs), Tempo (traces).&lt;/li>
&lt;li>&lt;strong>UI&lt;/strong>: Grafana with domain-specific dashboards.&lt;/li>
&lt;li>&lt;strong>Alerting&lt;/strong>: AlertManager with rules over the Hubble + Tetragon metrics.&lt;/li>
&lt;/ul>
&lt;h2 id="comparison-with-the-alternatives">Comparison with the alternatives&lt;/h2>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>System&lt;/th>
&lt;th>Layer&lt;/th>
&lt;th>Focus&lt;/th>
&lt;th>Model&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;strong>Hubble&lt;/strong>&lt;/td>
&lt;td>L3-L7 network&lt;/td>
&lt;td>K8s cluster with Cilium&lt;/td>
&lt;td>eBPF, pull metrics, push flows gRPC&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>GKE Dataplane v2 obs&lt;/strong>&lt;/td>
&lt;td>L3-L7 network&lt;/td>
&lt;td>GKE managed&lt;/td>
&lt;td>eBPF (Cilium-based, managed)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Tigera Calico Whisker&lt;/strong>&lt;/td>
&lt;td>L3-L7 network&lt;/td>
&lt;td>Cluster with Calico&lt;/td>
&lt;td>eBPF + pcap, own UI&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Tetragon&lt;/strong>&lt;/td>
&lt;td>Process/syscall&lt;/td>
&lt;td>K8s cluster&lt;/td>
&lt;td>eBPF, push events gRPC&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Falco&lt;/strong>&lt;/td>
&lt;td>Process/syscall&lt;/td>
&lt;td>K8s cluster&lt;/td>
&lt;td>eBPF in userspace or kernel module&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>AgentSight&lt;/strong>&lt;/td>
&lt;td>LLM agent&lt;/td>
&lt;td>Agentic systems&lt;/td>
&lt;td>eBPF (SSL uprobes + stdio)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Beyla&lt;/strong> (Grafana)&lt;/td>
&lt;td>Application&lt;/td>
&lt;td>App L7 + tracing&lt;/td>
&lt;td>eBPF (uprobes on libs)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Pixie&lt;/strong>&lt;/td>
&lt;td>App + system&lt;/td>
&lt;td>Broad cluster visibility&lt;/td>
&lt;td>eBPF + PXL script&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Parca&lt;/strong>&lt;/td>
&lt;td>CPU/mem profiling&lt;/td>
&lt;td>Performance&lt;/td>
&lt;td>eBPF profile sampling&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>If your CNI is Cilium, Hubble is the natural entry point and it does not compete with the rest: it complements them. For Calico clusters, Whisker is the equivalent. For profiling, Parca. For AI agents, AgentSight. The era of &amp;ldquo;one tool for everything&amp;rdquo; is passing: the modern stack combines several specialised pieces, all eBPF-based, exposed via OTLP.&lt;/p>
&lt;h2 id="operational-traps">Operational traps&lt;/h2>
&lt;h3 id="cardinality-in-prometheus">Cardinality in Prometheus&lt;/h3>
&lt;p>Hubble metrics with all the K8s labels can blow up Prometheus. &lt;strong>Measure cardinality before exporting everything.&lt;/strong> The most prolific metrics are &lt;code>flow&lt;/code> and &lt;code>httpV2&lt;/code>; start with &lt;code>drop&lt;/code> and &lt;code>port-distribution&lt;/code> and add the rest incrementally.&lt;/p>
&lt;h3 id="l7-visibility-costs-cpu">L7 visibility costs CPU&lt;/h3>
&lt;p>Enabling L7 parsing via embedded Envoy adds load to the agent (not to the base datapath, but yes to the node&amp;rsquo;s envoy proxy). For heavy HTTP traffic, measure. For flows where you only need L4, leave Envoy disabled.&lt;/p>
&lt;h3 id="hubble-relay-without-ha">Hubble Relay without HA&lt;/h3>
&lt;p>A single Relay replica is a single point of failure for the CLI and the UI (not for the local agent, which keeps working). For production, deploy with &lt;code>replicas: 2+&lt;/code> and &lt;code>topologySpreadConstraints&lt;/code> so both do not go down together.&lt;/p>
&lt;h3 id="encryption-status-reporting-depends-on-the-cilium-config">Encryption status reporting depends on the Cilium config&lt;/h3>
&lt;p>The new &lt;code>--encryption-status&lt;/code> filter only gives real data if Cilium has encryption enabled (WireGuard or IPsec). Without that, everything is &lt;code>unencrypted&lt;/code> and the filter contributes nothing.&lt;/p>
&lt;h3 id="ui-exposed-without-auth">UI exposed without auth&lt;/h3>
&lt;p>Hubble UI has no native auth. If you expose it through Ingress, &lt;strong>there has to be authentication in front of it&lt;/strong>: OIDC via oauth2-proxy, mTLS, IP allowlist. It is not optional.&lt;/p>
&lt;h3 id="storage-that-does-not-scale">Storage that does not scale&lt;/h3>
&lt;p>If you keep flows for days for forensics, the volume is serious. For a cluster with 100 active pods, easily 1-10 GB/day of flow logs. Plan the lifecycle (compaction, retention, cold storage) before enabling it.&lt;/p>
&lt;h2 id="what-we-have-not-covered">What we have not covered&lt;/h2>
&lt;ul>
&lt;li>&lt;strong>Mesh / multi-cluster Hubble&lt;/strong>: aggregating flows from several Cilium clusters into a single Relay. Use case: a cross-cluster view, debugging a distributed service mesh.&lt;/li>
&lt;li>&lt;code>hubble export&lt;/code>: local persistence on the agent&amp;rsquo;s disk for forensics with low retention.&lt;/li>
&lt;li>&lt;strong>Anomaly detection with your own models&lt;/strong>: how to connect the gRPC stream to a custom ML consumer.&lt;/li>
&lt;li>&lt;strong>AgentSight in depth&lt;/strong>: the project deserves its own article. Next instalment.&lt;/li>
&lt;li>&lt;strong>eBPF for LLM serving profiling&lt;/strong>: how to measure vLLM&amp;rsquo;s TTFT, TPOT and throughput without instrumenting, using uprobes on libcudart.&lt;/li>
&lt;/ul>
&lt;h2 id="references">References&lt;/h2>
&lt;p>Hubble and Cilium:&lt;/p>
&lt;ul>
&lt;li>&lt;a href="https://github.com/cilium/hubble">Hubble GitHub&lt;/a> — main repo.&lt;/li>
&lt;li>&lt;a href="https://docs.cilium.io/en/stable/observability/hubble/">Hubble — Network Observability (Cilium docs)&lt;/a> — official reference.&lt;/li>
&lt;li>&lt;a href="https://www.infoq.com/news/2026/02/cilium-119/">Cilium 1.19 release notes (InfoQ, feb 2026)&lt;/a> — tenth anniversary and 1.19 news.&lt;/li>
&lt;li>&lt;a href="https://github.com/cilium/cilium/releases">Cilium releases&lt;/a> — all releases.&lt;/li>
&lt;li>&lt;a href="https://grafana.com/grafana/dashboards/19423-hubble-l7-http-metrics-by-workload/">Hubble L7 HTTP Metrics — Grafana dashboard 19423&lt;/a> — ready to import.&lt;/li>
&lt;li>&lt;a href="https://cloud-cod.com/index.php/2026/03/03/end-to-end-l7-visibility-with-cilium-hubble/">End‑to‑end L7 Visibility with Cilium Hubble (cloud-cod.com, mar 2026)&lt;/a>.&lt;/li>
&lt;li>&lt;a href="https://www.youngju.dev/blog/cilium/cilium_hubble_observability.en">Cilium Hubble Observability Platform Internal Analysis (Young-ju)&lt;/a>.&lt;/li>
&lt;li>&lt;a href="https://johal.in/ciliumnetworkpolicy-python-hubble-l7-visibility-2026/">CiliumNetworkPolicy Python Hubble: L7 Visibility 2026&lt;/a> — one of the threads on the Python SDK.&lt;/li>
&lt;/ul>
&lt;p>State of the art 2026 and the full stack:&lt;/p>
&lt;ul>
&lt;li>&lt;a href="https://dev.to/x4nent/building-a-production-ebpf-observability-security-stack-for-kubernetes-in-2026-5051">Building a Production eBPF Observability &amp;amp; Security Stack for Kubernetes in 2026 (DEV)&lt;/a>.&lt;/li>
&lt;li>&lt;a href="https://www.cloudraft.io/blog/ebpf-based-network-observability-using-cilium-hubble">eBPF-Based Network Observability: Exploring Cilium Hubble and Alternatives (CloudRaft)&lt;/a>.&lt;/li>
&lt;/ul>
&lt;p>eBPF + AI agents:&lt;/p>
&lt;ul>
&lt;li>&lt;a href="https://github.com/eunomia-bpf/agentsight">AgentSight (GitHub eunomia-bpf)&lt;/a> — the referenced project.&lt;/li>
&lt;li>&lt;a href="https://klizosolutions.medium.com/harnessing-ebpf-for-high-performance-llm-workloads-a-cloud-native-guide-efb7d73e19ed">Harnessing eBPF for High‑Performance LLM Workloads (Klizo Solutions)&lt;/a>.&lt;/li>
&lt;/ul>
&lt;p>Cross-references:&lt;/p>
&lt;ul>
&lt;li>Part 1: &lt;a href="https://blog.lo0.es/en/posts/ebpf-zero-to-cilium-kernel-tcp-ip-bypass/">eBPF from zero to Cilium&lt;/a>.&lt;/li>
&lt;li>Part 2: &lt;a href="https://blog.lo0.es/en/posts/tetragon-cilium-security-syscalls-kernel/">Tetragon: Cilium&amp;rsquo;s security cousin&lt;/a>.&lt;/li>
&lt;li>LLM inference series: &lt;a href="https://blog.lo0.es/en/posts/kv-cache-working-memory-llm-inference/">KV cache&lt;/a>, &lt;a href="https://blog.lo0.es/en/posts/vllm-kubernetes-llm-inference-that-scales/">vLLM on K8s&lt;/a>, &lt;a href="https://blog.lo0.es/en/posts/pagedattention-vllm-block-manager/">PagedAttention&lt;/a>, &lt;a href="https://blog.lo0.es/en/posts/llm-inference-operators-kubernetes/">LLM K8s Operators&lt;/a> — where the traffic Hubble observes carries the prompts AgentSight inspects.&lt;/li>
&lt;/ul></description></item><item><title>Tetragon: Cilium's security cousin that sees every syscall in the kernel</title><link>https://blog.lo0.es/en/posts/tetragon-cilium-security-syscalls-kernel/</link><pubDate>Tue, 19 May 2026 05:00:00 +0200</pubDate><guid>https://blog.lo0.es/en/posts/tetragon-cilium-security-syscalls-kernel/</guid><description>&lt;h2 id="tldr">TL;DR&lt;/h2>
&lt;p>&lt;a href="https://tetragon.io/">Tetragon&lt;/a> is the runtime security and observability engine that the Cilium project published as a companion to the CNI. Its job is not to route packets, Cilium is already there for that, but to &lt;strong>observe what happens inside the node&amp;rsquo;s processes in real time&lt;/strong>: which binary runs in each pod, which files it opens, which syscalls it invokes, which capabilities it asks for, which network connections it establishes, which kernel modules get loaded. It does this by loading eBPF programs into the kernel&amp;rsquo;s hook points (kprobes, tracepoints, uprobes, LSM hooks) and filtering the relevant events &lt;strong>inside the kernel itself&lt;/strong> with a declarative language expressed as a CRD (&lt;code>TracingPolicy&lt;/code> and &lt;code>TracingPolicyNamespaced&lt;/code>). The result is a stream of events enriched with Kubernetes metadata (pod, namespace, labels) that costs less than 1% of CPU and, the thing that sets Tetragon apart from the competition, can &lt;strong>block actions inside the kernel&lt;/strong>, killing the process with &lt;code>SIGKILL&lt;/code> or overwriting a syscall&amp;rsquo;s return value, &lt;strong>before they finish executing&lt;/strong>, with no race conditions. Against Falco (which parses syscalls in userspace, 5-10% overhead, detection-only), Tetragon is &amp;ldquo;cheaper and with enforcement&amp;rdquo;; against the bare kernel, it is &amp;ldquo;a declarative layer your operations colleague can read&amp;rdquo;. This article is the extensive introduction you need to take it on seriously: architecture, all the hooks and selectors, the operating modes, a guide to use cases (exec auditing, sensitive file access, container escape, cryptomining, rootkit detection, network observability) and the traps you see in production.&lt;/p>
&lt;blockquote>
&lt;p>This article is part 2 of the eBPF series. Part 1, &lt;a href="https://blog.lo0.es/en/posts/ebpf-zero-to-cilium-kernel-tcp-ip-bypass/">eBPF from zero to Cilium: how the kernel learned to skip its own TCP/IP stack&lt;/a>, covered basic eBPF, the networking hooks (XDP, TC, sock_ops), how Cilium implements the datapath and the BGP Control Plane v2 CRDs. Here we take those same eBPF hooks and use them for something different: &lt;strong>observing and, if needed, stopping&lt;/strong> what the cluster&amp;rsquo;s processes do.&lt;/p>
&lt;/blockquote>
&lt;h2 id="the-analogy-auditd-on-steroids-in-ebpf">The analogy: auditd on steroids in eBPF&lt;/h2>
&lt;p>Anyone who has spent a few years administering Linux has used &lt;code>auditd&lt;/code>. It is the classic kernel subsystem for auditing syscalls: you configure a rule with &lt;code>auditctl&lt;/code> (for instance, &amp;ldquo;monitor any &lt;code>open&lt;/code> on &lt;code>/etc/shadow&lt;/code>&amp;rdquo;) and the kernel sends events to a userspace daemon that persists them. It works, but it has two limitations that weigh heavily on modern Kubernetes clusters:&lt;/p>
&lt;ol>
&lt;li>&lt;strong>No Kubernetes context.&lt;/strong> auditd reports processes by PID and UID. Knowing which pod, which namespace, which image, which labels, the information that actually matters when responding to an incident, requires correlating afterwards with data from cri-o or containerd. It is operationally miserable.&lt;/li>
&lt;li>&lt;strong>No granular enforcement.&lt;/strong> auditd can generate events, but it cannot take the decision to kill the offending process before the syscall finishes. You leave that to a higher layer that reads the events, processes them and kills the process… if it gets there in time. A race by design.&lt;/li>
&lt;/ol>
&lt;p>Tetragon is &lt;strong>auditd on steroids&lt;/strong>: the same conceptual ideas, hooks on syscalls and events to userspace, but implemented with modern eBPF, with filtering inside the kernel so you do not pay the cost of waking the daemon for every irrelevant syscall, with Kubernetes metadata injected by an agent that knows the cluster, and with actions executed inside the kernel itself without waiting for userspace to decide. If the rule says &amp;ldquo;kill any process that opens &lt;code>/etc/shadow&lt;/code> from the &lt;code>prod&lt;/code> namespace&amp;rdquo;, the decision is taken in the kernel kprobe and &lt;code>SIGKILL&lt;/code> is delivered before the &lt;code>open&lt;/code> completes. There is no race; there is no window between detection and action.&lt;/p>
&lt;h2 id="what-tetragon-is-architecturally">What Tetragon is, architecturally&lt;/h2>
&lt;p>Tetragon is an agent deployed as a &lt;code>DaemonSet&lt;/code> (one pod per node) and a set of CRDs that define the policies to apply. The agent has four responsibilities:&lt;/p>
&lt;ol>
&lt;li>&lt;strong>Load eBPF programs&lt;/strong> into the hook points the active TracingPolicies demand.&lt;/li>
&lt;li>&lt;strong>Maintain a cache of Kubernetes metadata&lt;/strong> (pods, namespaces, labels) by reading the API server, so it can enrich every event with the right context.&lt;/li>
&lt;li>&lt;strong>Collect the events&lt;/strong> the eBPF programs emit (via ring buffers) and serialise them.&lt;/li>
&lt;li>&lt;strong>Export the events&lt;/strong> to configurable destinations: &lt;code>stdout&lt;/code> JSON (typical in sidecars or log-collection agents), gRPC streaming (to consume them from Hubble or another consumer), a file, or Fluentd/Loki/SIEM.&lt;/li>
&lt;/ol>
&lt;p>The eBPF programs are not written by the user. Tetragon generates the bytecode from the TracingPolicies: it reads the declarative policy, decides which hooks to attack, which arguments to read from the kernel, which filters to apply inline and which actions to execute. The user only writes &lt;strong>YAML&lt;/strong>.&lt;/p>
&lt;div class="diagram" style="max-width:720px;margin:1.5rem auto;">
&lt;svg viewBox="0 0 720 280" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Tetragon architecture">
&lt;style>.title{font:600 13px sans-serif;fill:#222}.lbl{font:600 12px sans-serif;fill:#222}.sm{font:11px sans-serif;fill:#555}.box{stroke:#444;stroke-width:1.4}.k{fill:#ffe9d6}.u{fill:#d6eaff}.p{fill:#d9f5d6}.api{fill:#e9d6f5}.arr{stroke:#666;stroke-width:1.4;fill:none;marker-end:url(#h)}&lt;/style>
&lt;defs>&lt;marker id="h" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6" markerHeight="6" orient="auto">&lt;path d="M0,0 L10,5 L0,10 z" fill="#666"/>&lt;/marker>&lt;/defs>
&lt;text x="360" y="20" text-anchor="middle" class="title">Tetragon: control and data planes on a node&lt;/text>
&lt;rect x="40" y="50" width="200" height="70" rx="6" class="box k"/>
&lt;text x="140" y="70" text-anchor="middle" class="lbl">eBPF programs&lt;/text>
&lt;text x="140" y="90" text-anchor="middle" class="sm">kprobes, tracepoints,&lt;/text>
&lt;text x="140" y="105" text-anchor="middle" class="sm">uprobes, LSM&lt;/text>
&lt;rect x="40" y="160" width="200" height="60" rx="6" class="box u"/>
&lt;text x="140" y="183" text-anchor="middle" class="lbl">Tetragon agent&lt;/text>
&lt;text x="140" y="203" text-anchor="middle" class="sm">reads events from the ring buffer&lt;/text>
&lt;rect x="290" y="160" width="180" height="60" rx="6" class="box api"/>
&lt;text x="380" y="183" text-anchor="middle" class="lbl">Kubernetes API&lt;/text>
&lt;text x="380" y="203" text-anchor="middle" class="sm">pods, namespaces, labels&lt;/text>
&lt;rect x="510" y="50" width="180" height="70" rx="6" class="box p"/>
&lt;text x="600" y="70" text-anchor="middle" class="lbl">TracingPolicy CRDs&lt;/text>
&lt;text x="600" y="90" text-anchor="middle" class="sm">declarative YAML&lt;/text>
&lt;text x="600" y="105" text-anchor="middle" class="sm">cluster or namespaced&lt;/text>
&lt;rect x="510" y="160" width="180" height="60" rx="6" class="box u"/>
&lt;text x="600" y="183" text-anchor="middle" class="lbl">Exporters&lt;/text>
&lt;text x="600" y="203" text-anchor="middle" class="sm">stdout, gRPC, file, SIEM&lt;/text>
&lt;path class="arr" d="M510,80 L240,80"/>
&lt;text x="375" y="74" text-anchor="middle" class="sm">policies → bytecode&lt;/text>
&lt;path class="arr" d="M140,120 L140,160"/>
&lt;text x="160" y="143" text-anchor="middle" class="sm">events&lt;/text>
&lt;path class="arr" d="M290,190 L240,190"/>
&lt;text x="265" y="184" text-anchor="middle" class="sm">enrich&lt;/text>
&lt;path class="arr" d="M240,180 L510,180"/>
&lt;text x="375" y="174" text-anchor="middle" class="sm">enriched events&lt;/text>
&lt;text x="360" y="255" text-anchor="middle" class="sm">The arrows show data flow. TracingPolicies are compiled into eBPF programs;&lt;/text>
&lt;text x="360" y="270" text-anchor="middle" class="sm">events travel kernel → agent → exporter, decorated with K8s metadata along the way.&lt;/text>
&lt;/svg>
&lt;/div>
&lt;p>This separation of declarative policy → generated eBPF bytecode is what makes Tetragon usable. Writing eBPF programs by hand is a specialist&amp;rsquo;s job; writing a &lt;code>TracingPolicy&lt;/code> is the job of an SRE with a good example in front of them.&lt;/p>
&lt;h2 id="the-two-crds-tracingpolicy-and-tracingpolicynamespaced">The two CRDs: TracingPolicy and TracingPolicyNamespaced&lt;/h2>
&lt;p>Tetragon exposes exactly two main CRDs:&lt;/p>
&lt;ul>
&lt;li>&lt;code>TracingPolicy&lt;/code> (cluster-scoped, &lt;code>cilium.io/v1alpha1&lt;/code>): applies to the whole cluster, every node, every pod. Suitable for platform policies (the whole cluster must be audited the same way): for example, &amp;ldquo;log every &lt;code>execve&lt;/code> in every pod&amp;rdquo; or &amp;ldquo;kill any process that tries to load a kernel module&amp;rdquo;.&lt;/li>
&lt;li>&lt;code>TracingPolicyNamespaced&lt;/code> (namespaced, same group and version): defined inside a namespace and applied only to the pods of that namespace. Suitable for policies with per-tenant autonomy: for example, &amp;ldquo;in the &lt;code>prod-payments&lt;/code> namespace, kill any outbound &lt;code>connect&lt;/code> to an IP outside the corporate range&amp;rdquo;.&lt;/li>
&lt;/ul>
&lt;p>Both CRDs have exactly the same internal structure. The difference is one of scope. The distinction was introduced precisely to allow multi-tenancy: the central security team defines cluster-wide &lt;code>TracingPolicy&lt;/code> objects and each tenant can add its own with &lt;code>TracingPolicyNamespaced&lt;/code> without needing cluster-admin permissions.&lt;/p>
&lt;h2 id="anatomy-of-a-tracingpolicy">Anatomy of a TracingPolicy&lt;/h2>
&lt;p>A policy is made up of:&lt;/p>
&lt;ol>
&lt;li>&lt;strong>Hook points&lt;/strong>: which kernel events to observe.&lt;/li>
&lt;li>&lt;strong>Arguments&lt;/strong>: which data to read when the hook fires.&lt;/li>
&lt;li>&lt;strong>Selectors&lt;/strong>: filters evaluated inside the kernel to discard irrelevant events and, optionally, execute actions when they match.&lt;/li>
&lt;/ol>
&lt;h3 id="supported-hook-points">Supported hook points&lt;/h3>
&lt;p>The official documentation lists five families of hook points:&lt;/p>
&lt;ul>
&lt;li>&lt;code>kprobes&lt;/code>: hook a kernel function. Syscalls are a particular case (when &lt;code>syscall: true&lt;/code>) because their ABI differs from that of internal functions. Typical examples: &lt;code>sys_open&lt;/code>, &lt;code>sys_openat&lt;/code>, &lt;code>sys_connect&lt;/code>, &lt;code>tcp_connect&lt;/code>, &lt;code>do_mount&lt;/code>, &lt;code>commit_creds&lt;/code>. It is the most versatile hook and the one used 80% of the time.&lt;/li>
&lt;li>&lt;code>tracepoints&lt;/code>: hook static tracepoints compiled into the kernel. More stable across kernel versions than kprobes (they do not depend on function names that can change). Examples: &lt;code>syscalls/sys_enter_openat&lt;/code>, &lt;code>sched/sched_process_exec&lt;/code>.&lt;/li>
&lt;li>&lt;code>uprobes&lt;/code>: hook functions in userspace libraries or binaries. They serve to observe runtime primitives such as libssl functions, libc, the Go runtime, the JVM.&lt;/li>
&lt;li>&lt;strong>USDT &lt;code>tracepoints&lt;/code>&lt;/strong> (User Statically Defined Tracepoints): static tracepoints defined in userspace binaries (like those MySQL, PostgreSQL and OpenJDK expose). Useful for application observability.&lt;/li>
&lt;li>&lt;code>lsmHooks&lt;/code> (LSM, Linux Security Module): hooks of the LSM subsystem, where SELinux/AppArmor plug in. They allow security policies very similar to traditional MAC but programmable with eBPF. Example: &lt;code>file_open&lt;/code>, &lt;code>inode_unlink&lt;/code>, &lt;code>socket_bind&lt;/code>.&lt;/li>
&lt;/ul>
&lt;h3 id="arguments">Arguments&lt;/h3>
&lt;p>Every hook can read the arguments of the function it is attached to. The supported types cover the primitives (&lt;code>int&lt;/code>, &lt;code>uint64&lt;/code>, &lt;code>bool&lt;/code>, &lt;code>string&lt;/code>, &lt;code>char_buf&lt;/code>) and higher abstractions (&lt;code>file&lt;/code>, &lt;code>path&lt;/code>, &lt;code>sock&lt;/code>, &lt;code>linux_binprm&lt;/code>, &lt;code>capability&lt;/code>, &lt;code>bpf_attr&lt;/code>, &lt;code>cred&lt;/code>). The high-level types are pointers to kernel structures that Tetragon knows how to parse; instead of having to read an offset, you write &lt;code>type: file&lt;/code> and Tetragon gives you the full path of the descriptor&amp;rsquo;s file.&lt;/p>
&lt;p>There is an important capability detail: on kernels ≥ 5.4, Tetragon can read &lt;strong>up to 327,360 bytes&lt;/strong> of an argument if the large buffers flag is enabled. That is the difference between being able to audit &lt;code>execve&lt;/code> with all of its long argv complete versus truncating them at 256 bytes and losing context.&lt;/p>
&lt;h3 id="selectors-filtering-in-the-kernel">Selectors: filtering in the kernel&lt;/h3>
&lt;p>Selectors are what make Tetragon cheap. Without them, every syscall on the node would fire an event that would travel kernel → ring buffer → agent → processed → filtered → discarded. With selectors, the filtering happens &lt;strong>inside the eBPF program itself, in the kernel&lt;/strong>, and only the events that matter reach userspace.&lt;/p>
&lt;p>The available selectors include:&lt;/p>
&lt;ul>
&lt;li>&lt;code>matchArgs&lt;/code>: filters by an argument&amp;rsquo;s value. Operators: &lt;code>Equal&lt;/code>, &lt;code>NotEqual&lt;/code>, &lt;code>Prefix&lt;/code>, &lt;code>Postfix&lt;/code>, &lt;code>GreaterThan&lt;/code>, &lt;code>LessThan&lt;/code>, &lt;code>Mask&lt;/code>, &lt;code>SPort&lt;/code> (source port), &lt;code>DPort&lt;/code> (dest port), &lt;code>Family&lt;/code> (AF_INET vs AF_INET6), &lt;code>State&lt;/code> (socket state).&lt;/li>
&lt;li>&lt;code>matchPIDs&lt;/code>: filters by PID; useful for targeted observation.&lt;/li>
&lt;li>&lt;code>matchBinaries&lt;/code>: filters by the binary executing the syscall (absolute path), with &lt;code>Operator: In&lt;/code>, &lt;code>NotIn&lt;/code>, &lt;code>Prefix&lt;/code>. Essential for avoiding noise from legitimate system processes.&lt;/li>
&lt;li>&lt;code>matchNamespaces&lt;/code>: filters by Linux namespace (Pid, Mnt, Net, Ipc, Cgroup, User). It allows policies specific to processes in containers versus the host.&lt;/li>
&lt;li>&lt;code>matchCapabilities&lt;/code>: filters by the process&amp;rsquo;s effective capabilities. Block actions requiring &lt;code>CAP_SYS_ADMIN&lt;/code> that run in pods that should not have them.&lt;/li>
&lt;li>&lt;code>matchNamespaceChanges&lt;/code>: detects namespace changes (typical of container escape).&lt;/li>
&lt;li>&lt;code>matchCapabilityChanges&lt;/code>: detects capability changes (privilege escalation).&lt;/li>
&lt;li>&lt;code>matchActions&lt;/code>: the actions executed when all the preceding matchers hit.&lt;/li>
&lt;/ul>
&lt;h3 id="actions-from-a-simple-post-to-sigkill">Actions: from a simple Post to Sigkill&lt;/h3>
&lt;p>When a selector matches, an &lt;code>action&lt;/code> is executed. Tetragon defines several:&lt;/p>
&lt;ul>
&lt;li>&lt;code>Post&lt;/code>: emits an event to userspace (the observability case). It supports &lt;code>rateLimit&lt;/code> to avoid flooding the agent if the condition fires a thousand times per second. The syntax accepts &lt;code>5&lt;/code> for 5 seconds, &lt;code>5m&lt;/code> for 5 minutes, &lt;code>1h&lt;/code> for 1 hour.&lt;/li>
&lt;li>&lt;code>Sigkill&lt;/code>: sends &lt;code>SIGKILL&lt;/code> to the offending process from inside the kernel, &lt;strong>before the syscall completes&lt;/strong>. This is the only thing that guarantees enforcement without a race.&lt;/li>
&lt;li>&lt;code>Override&lt;/code>: overwrites the syscall&amp;rsquo;s return value. Useful for making the process believe the syscall failed (&lt;code>Override -EPERM&lt;/code>) without killing it. A better experience for apps that can handle errors; worse for apps that assume success.&lt;/li>
&lt;li>&lt;code>Signal&lt;/code>: sends any arbitrary signal (not just &lt;code>SIGKILL&lt;/code>).&lt;/li>
&lt;li>&lt;code>NoPost&lt;/code>: does not emit an event, useful when combined with another selector that does emit and you only want the action without duplicated telemetry.&lt;/li>
&lt;li>&lt;strong>&lt;code>FollowFD&lt;/code> and &lt;code>UnfollowFD&lt;/code>&lt;/strong>: mark a file descriptor to follow its lifecycle and enrich subsequent events with the original path. Useful for auditing &amp;ldquo;which process read this file after opening it&amp;rdquo;.&lt;/li>
&lt;li>&lt;code>TrackSock&lt;/code> and &lt;code>UntrackSock&lt;/code>: the same for sockets.&lt;/li>
&lt;li>&lt;strong>&lt;code>GetUrl&lt;/code> and &lt;code>DnsLookup&lt;/code>&lt;/strong>: make HTTP requests or DNS resolutions from the kernel. Designed for integrations with external systems (security webhooks, IP reputation lookups).&lt;/li>
&lt;li>&lt;code>NotifyEnforcer&lt;/code> and &lt;code>CleanupEnforcerNotification&lt;/code>: communication with Tetragon&amp;rsquo;s enforcement subsystem for complex actions.&lt;/li>
&lt;/ul>
&lt;h2 id="modes-detection-vs-enforcement">Modes: detection vs enforcement&lt;/h2>
&lt;p>A policy can be declared in one of two explicit modes:&lt;/p>
&lt;ul>
&lt;li>&lt;code>enforce&lt;/code>: enforcement actions (&lt;code>Sigkill&lt;/code>, &lt;code>Override&lt;/code>, &lt;code>Signal&lt;/code>) are active. This is production.&lt;/li>
&lt;li>&lt;code>monitoring&lt;/code>: enforcement actions are ignored; only &lt;code>Post&lt;/code> events are emitted. This is the &amp;ldquo;let us see what would happen if this were switched on&amp;rdquo; mode, critical for testing policies without breaking applications.&lt;/li>
&lt;/ul>
&lt;p>Control is done with the &lt;code>spec.options[].name: policy-mode&lt;/code> field and &lt;code>value: monitoring&lt;/code> or &lt;code>enforce&lt;/code>. It is the best practice: start in &lt;code>monitoring&lt;/code>, collect events for days, tune the selectors until no false positives come out, and only then switch to &lt;code>enforce&lt;/code>.&lt;/p>
&lt;h2 id="full-example-blocking-writes-to-etcpasswd-in-the-prod-namespace">Full example: blocking writes to &lt;code>/etc/passwd&lt;/code> in the prod namespace&lt;/h2>
&lt;p>A realistic policy, commented line by line:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-yaml" data-lang="yaml">&lt;span class="line">&lt;span class="cl">&lt;span class="nt">apiVersion&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">cilium.io/v1alpha1&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">kind&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">TracingPolicyNamespaced&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">metadata&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">block-passwd-write&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">namespace&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">prod&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">spec&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">kprobes&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">call&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;fd_install&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">syscall&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="kc">false&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c"># kernel function, not a syscall&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">args&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">index&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">0&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">type&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">int &lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c"># file descriptor&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">index&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">1&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">type&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;file&amp;#34;&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c"># struct file*&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">selectors&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">matchArgs&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">index&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">1&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">operator&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;Equal&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">values&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="s2">&amp;#34;/etc/passwd&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">matchActions&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">action&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">Sigkill &lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c"># kills the process&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">rateLimit&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;1m&amp;#34;&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c"># max once per minute&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">options&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">policy-mode&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">value&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">enforce &lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c"># enforcement mode active&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;code>fd_install&lt;/code> runs every time a process obtains a new file descriptor; the second argument is the file&amp;rsquo;s &lt;code>file&lt;/code> struct. Tetragon knows how to resolve it to its absolute path. The &lt;code>matchArgs&lt;/code> compares that path with &lt;code>/etc/passwd&lt;/code>. If it matches, &lt;code>Sigkill&lt;/code> kills the process before the descriptor even becomes usable. &lt;code>rateLimit: 1m&lt;/code> stops the agent from saturating if a malicious application tries it in a loop.&lt;/p>
&lt;h2 id="common-use-cases">Common use cases&lt;/h2>
&lt;p>Now to real use. These are the six cases that show up in any serious Tetragon deployment in 2026.&lt;/p>
&lt;h3 id="1-execution-auditing-execve">1. Execution auditing (&lt;code>execve&lt;/code>)&lt;/h3>
&lt;p>The most basic use case and, even so, the most valuable. Which binaries are running in each pod? In a container that is supposed to run only &lt;code>nginx&lt;/code>, suddenly seeing an &lt;code>sh&lt;/code> or a &lt;code>wget&lt;/code> is almost always a red flag.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-yaml" data-lang="yaml">&lt;span class="line">&lt;span class="cl">&lt;span class="nt">apiVersion&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">cilium.io/v1alpha1&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">kind&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">TracingPolicy&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">metadata&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">audit-execve&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">spec&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">tracepoints&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">subsystem&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;sched&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">event&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;sched_process_exec&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">args&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">index&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">4&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">type&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">linux_binprm &lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c"># struct linux_binprm*&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">selectors&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">matchActions&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">action&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">Post &lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c"># events only, no enforcement&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>With no filters: every &lt;code>execve&lt;/code> in the cluster generates an event. With K8s metadata, the event includes pod, namespace, container, image, labels. You turn it into a stream of events towards your SIEM and set up rules: &amp;ldquo;alert if I see &lt;code>sh&lt;/code>, &lt;code>bash&lt;/code>, &lt;code>nc&lt;/code>, &lt;code>curl&lt;/code>, &lt;code>wget&lt;/code> or &lt;code>python&lt;/code> running in any pod of the &lt;code>prod-api&lt;/code> namespace&amp;rdquo;.&lt;/p>
&lt;p>An enforcement variant: instead of &lt;code>Post&lt;/code>, use &lt;code>matchBinaries&lt;/code> with &lt;code>Operator: NotIn&lt;/code> and a whitelist, plus &lt;code>Sigkill&lt;/code> if the binary is not on the list. A very rigid box, but effective in pods that are &amp;ldquo;single-binary&amp;rdquo; (like a Go microservice).&lt;/p>
&lt;h3 id="2-sensitive-file-access">2. Sensitive file access&lt;/h3>
&lt;p>Detecting (or blocking) reads and writes on critical files: &lt;code>/etc/shadow&lt;/code>, &lt;code>/etc/kubernetes/&lt;/code>, Secret mounts, &lt;code>/var/run/docker.sock&lt;/code>, &lt;code>/proc/*/cmdline&lt;/code>.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-yaml" data-lang="yaml">&lt;span class="line">&lt;span class="cl">&lt;span class="nt">apiVersion&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">cilium.io/v1alpha1&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">kind&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">TracingPolicy&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">metadata&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">sensitive-file-access&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">spec&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">kprobes&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">call&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;security_file_open&amp;#34;&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c"># LSM-ish via kprobe&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">syscall&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="kc">false&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">args&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">index&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">0&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">type&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;file&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">selectors&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">matchArgs&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">index&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">0&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">operator&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;Prefix&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">values&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="s2">&amp;#34;/etc/shadow&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="s2">&amp;#34;/var/run/secrets/&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="s2">&amp;#34;/var/run/docker.sock&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">matchBinaries&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">operator&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;NotIn&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">values&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="s2">&amp;#34;/usr/bin/kubelet&amp;#34;&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c"># legitimate kubelet access&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">matchActions&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">action&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">Post&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The &lt;code>matchBinaries: NotIn&lt;/code> is important: kubelet and other legitimate node agents access these paths constantly and would generate noise. We filter those out in the kernel.&lt;/p>
&lt;p>In enforcement: swap &lt;code>Post&lt;/code> for &lt;code>Override&lt;/code> with &lt;code>argError: -1&lt;/code> (&lt;code>EPERM&lt;/code>), so that the open fails but the offending process stays alive and produces the error so that tracing tools pick it up.&lt;/p>
&lt;h3 id="3-unauthorised-outbound-network-connections">3. Unauthorised outbound network connections&lt;/h3>
&lt;p>Detecting outbound connections to destinations outside the corporate range. Useful for spotting data exfiltration or malware command-and-control.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-yaml" data-lang="yaml">&lt;span class="line">&lt;span class="cl">&lt;span class="nt">apiVersion&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">cilium.io/v1alpha1&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">kind&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">TracingPolicyNamespaced&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">metadata&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">block-external-egress&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">namespace&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">prod&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">spec&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">kprobes&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">call&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;tcp_connect&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">syscall&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="kc">false&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">args&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">index&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">0&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">type&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;sock&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">selectors&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">matchArgs&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">index&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">0&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">operator&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;NotDAddr&amp;#34;&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c"># destination NOT in these CIDRs&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">values&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="s2">&amp;#34;10.0.0.0/8&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="s2">&amp;#34;192.168.0.0/16&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="s2">&amp;#34;172.16.0.0/12&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">matchActions&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">action&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">Sigkill&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">options&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">policy-mode&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">value&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">enforce&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>This kills any attempt at a TCP connection to an IP that is not in the corporate CIDRs, in the &lt;code>prod&lt;/code> namespace. Cilium already does this with NetworkPolicy, but Tetragon has two complementary advantages:&lt;/p>
&lt;ul>
&lt;li>It gives you the process that attempted the connection, not just &amp;ldquo;pod X tried to connect to Y&amp;rdquo;.&lt;/li>
&lt;li>It also works for exotic protocols where NetworkPolicy is less expressive.&lt;/li>
&lt;/ul>
&lt;h3 id="4-container-escape-detection">4. Container escape detection&lt;/h3>
&lt;p>Container escape is the operational nightmare: a process inside a container manages to break the isolation (via a kernel exploit, a badly set capability, a misconfigured &lt;code>hostPath&lt;/code> mount) and gain access to the host. Three typical signals:&lt;/p>
&lt;ul>
&lt;li>A namespace change on the process (it leaves the container&amp;rsquo;s &lt;code>pid&lt;/code> namespace).&lt;/li>
&lt;li>&lt;strong>&lt;code>setns&lt;/code> or &lt;code>unshare&lt;/code>&lt;/strong> in non-init processes.&lt;/li>
&lt;li>&lt;strong>Access to &lt;code>/proc/1/root&lt;/code> or &lt;code>/dev/&lt;/code>&lt;/strong> from a container.&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-yaml" data-lang="yaml">&lt;span class="line">&lt;span class="cl">&lt;span class="nt">apiVersion&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">cilium.io/v1alpha1&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">kind&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">TracingPolicy&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">metadata&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">detect-container-escape&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">spec&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">kprobes&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">call&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;__x64_sys_setns&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">syscall&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="kc">true&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">args&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">index&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">0&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">type&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">int&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">index&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">1&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">type&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">int&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">selectors&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">matchNamespaces&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">namespace&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">Pid&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">operator&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">NotIn&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">values&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;host_ns&amp;#34;&lt;/span>&lt;span class="p">]&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c"># only processes NOT in the host pid namespace&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">matchActions&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">action&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">Sigkill&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">call&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;__x64_sys_unshare&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">syscall&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="kc">true&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">args&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">index&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">0&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">type&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">int&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">selectors&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">matchNamespaceChanges&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">unshare&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="kc">true&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">matchActions&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">action&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">Post&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;code>__x64_sys_setns&lt;/code> targeting the host namespace from a process in a container is practically always malicious (legitimate containers do not need this at runtime).&lt;/p>
&lt;h3 id="5-cryptomining">5. Cryptomining&lt;/h3>
&lt;p>Mining processes have fairly recognisable profiles:&lt;/p>
&lt;ul>
&lt;li>Processes with names like &lt;code>xmrig&lt;/code>, &lt;code>minerd&lt;/code>, &lt;code>cgminer&lt;/code>, or legitimate processes such as &lt;code>python&lt;/code> running CPU-intensive scripts.&lt;/li>
&lt;li>Outbound connections to known mining pools (a public list of IPs and domains).&lt;/li>
&lt;li>Anomalous use of &lt;code>/dev/cpu_dma_latency&lt;/code> to avoid throttling.&lt;/li>
&lt;/ul>
&lt;p>A combined policy:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-yaml" data-lang="yaml">&lt;span class="line">&lt;span class="cl">&lt;span class="nt">apiVersion&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">cilium.io/v1alpha1&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">kind&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">TracingPolicy&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">metadata&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">detect-cryptomining&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">spec&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">tracepoints&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">subsystem&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;sched&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">event&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;sched_process_exec&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">args&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">index&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">4&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">type&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">linux_binprm&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">selectors&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">matchArgs&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">index&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">4&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">operator&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;Postfix&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">values&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="s2">&amp;#34;/xmrig&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="s2">&amp;#34;/minerd&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="s2">&amp;#34;/cgminer&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">matchActions&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">action&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">Sigkill&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">kprobes&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">call&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;tcp_connect&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">syscall&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="kc">false&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">args&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">index&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">0&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">type&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;sock&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">selectors&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">matchArgs&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">index&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">0&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">operator&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;DPort&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">values&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;3333&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;5555&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;7777&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;14444&amp;#34;&lt;/span>&lt;span class="p">]&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c"># common pool ports&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">matchActions&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">action&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">Post &lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c"># log only&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The double policy: kill binaries with the classic names (belt) and log connections to pool ports (braces), so you also get an alert when someone renames &lt;code>xmrig&lt;/code> to &lt;code>nginx-helper&lt;/code> or uses exotic ports.&lt;/p>
&lt;h3 id="6-detecting-rootkits-and-suspicious-kernel-modules">6. Detecting rootkits and suspicious kernel modules&lt;/h3>
&lt;p>Modern rootkits load kernel modules to patch functions (hide processes, hide network connections, hide files). Detecting them:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-yaml" data-lang="yaml">&lt;span class="line">&lt;span class="cl">&lt;span class="nt">apiVersion&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">cilium.io/v1alpha1&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">kind&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">TracingPolicy&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">metadata&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">kernel-module-load&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">spec&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">kprobes&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">call&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;do_init_module&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">syscall&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="kc">false&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">args&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">index&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">0&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">type&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;string&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">selectors&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">matchActions&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">action&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">Post&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">call&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;security_kernel_read_file&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">syscall&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="kc">false&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">args&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">index&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">0&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">type&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;file&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">index&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">1&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">type&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">int&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">selectors&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">matchArgs&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">index&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">1&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">operator&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;Equal&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">values&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;READING_MODULE&amp;#34;&lt;/span>&lt;span class="p">]&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">matchActions&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">action&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">Post&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>In a &amp;ldquo;well configured&amp;rdquo; Kubernetes cluster no new kernel modules get loaded at runtime; any event here is highly suspicious. Combine with enforcement on machines where modules should be fixed: &lt;code>Sigkill&lt;/code> for whoever tries to load one.&lt;/p>
&lt;h3 id="bonus-detecting-third-party-modification-of-ebpf-maps">Bonus: detecting third-party modification of eBPF maps&lt;/h3>
&lt;p>As a 2025-2026 trend: loading malicious eBPF programs to hide presence. Tetragon can observe the bpf syscall:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-yaml" data-lang="yaml">&lt;span class="line">&lt;span class="cl">&lt;span class="nt">apiVersion&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">cilium.io/v1alpha1&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">kind&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">TracingPolicy&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">metadata&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">audit-bpf-syscalls&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">spec&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">kprobes&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">call&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;__x64_sys_bpf&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">syscall&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="kc">true&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">args&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">index&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">0&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">type&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">int &lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c"># bpf cmd&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">index&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">1&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">type&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">bpf_attr&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">selectors&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">matchBinaries&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">operator&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;NotIn&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">values&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="s2">&amp;#34;/usr/bin/cilium-agent&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="s2">&amp;#34;/usr/bin/tetragon&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="s2">&amp;#34;/usr/bin/bpftool&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">matchActions&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">action&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">Post&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Any process that is &lt;strong>not&lt;/strong> one of the legitimate agents loading eBPF programs: you want to know about it.&lt;/p>
&lt;h2 id="comparison-with-falco">Comparison with Falco&lt;/h2>
&lt;p>&lt;a href="https://falco.org/">Falco&lt;/a> is the closest competitor: it is also runtime security for Kubernetes, also originally based on eBPF (and before that on kernel modules), also with declarative policies. Three years ago they were functionally similar. In 2026 the divergence is clear:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Dimension&lt;/th>
&lt;th>Tetragon&lt;/th>
&lt;th>Falco&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>Philosophy&lt;/td>
&lt;td>Cilium-native, integrated&lt;/td>
&lt;td>Standalone, generic&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Filtering&lt;/td>
&lt;td>In the kernel (eBPF)&lt;/td>
&lt;td>Parsing in userspace&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Typical overhead&lt;/td>
&lt;td>&lt;strong>&amp;lt;1% CPU&lt;/strong>&lt;/td>
&lt;td>5-10% CPU&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Enforcement&lt;/td>
&lt;td>&lt;strong>Yes, in-kernel (Sigkill, Override)&lt;/strong>&lt;/td>
&lt;td>Not native (depends on plugins)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Race conditions&lt;/td>
&lt;td>No (action atomic with the syscall)&lt;/td>
&lt;td>Yes, in enforcement via plugins&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>False positive rate&lt;/td>
&lt;td>Low (K8s context in the kernel)&lt;/td>
&lt;td>Higher (parsing afterwards)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Detection latency&lt;/td>
&lt;td>5-26 ms&lt;/td>
&lt;td>~10 ms (more constant)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Ecosystem maturity&lt;/td>
&lt;td>Young, growing&lt;/td>
&lt;td>Mature, plenty of material&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Community&lt;/td>
&lt;td>Cilium / CNCF Incubating&lt;/td>
&lt;td>CNCF Graduated&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Integrations&lt;/td>
&lt;td>Hubble native&lt;/td>
&lt;td>Falcosidekick, many&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>CRDs per policy&lt;/td>
&lt;td>TracingPolicy / Namespaced&lt;/td>
&lt;td>No CRDs; rules in YAML&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>&lt;strong>When to choose each one&lt;/strong>:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Tetragon&lt;/strong> if you already use Cilium, if you need enforcement in the kernel (not detection-only), if overhead matters to you (workloads with many syscalls), and if you value the Hubble integration. Container escape and cryptomining detection is where its advantage over Falco shows up most.&lt;/li>
&lt;li>&lt;strong>Falco&lt;/strong> if you want a tool independent of the CNI, if you need the catalogue of ready-made rules and the wide community, if your cluster is not Cilium, or if the integration with SIEMs and ready-made notifiers (Falcosidekick) saves you work.&lt;/li>
&lt;li>&lt;strong>Both&lt;/strong> if the organisation is large: Falco for breadth of detection, Tetragon for surgical enforcement on critical workloads. That is what you see most in companies that have spent years with Falco and add Tetragon for specific cases.&lt;/li>
&lt;/ul>
&lt;h2 id="hubble--tetragon-unified-observability">Hubble + Tetragon: unified observability&lt;/h2>
&lt;p>&lt;a href="https://docs.cilium.io/en/stable/observability/hubble/">Hubble&lt;/a> is Cilium&amp;rsquo;s traffic observability component: it shows L3-L7 flow logs with zero impact on latency. Tetragon exposes its events over gRPC with the same format and vocabulary as Hubble, which allows you to:&lt;/p>
&lt;ul>
&lt;li>See them in the same UI (Hubble UI shows Tetragon events as one more &amp;ldquo;layer&amp;rdquo;).&lt;/li>
&lt;li>Correlate network events (Hubble) with process events (Tetragon) on the same timeline.&lt;/li>
&lt;li>Export them together to Loki/Tempo/SIEM as a single stream.&lt;/li>
&lt;/ul>
&lt;p>The key synergy: Hubble tells you &amp;ldquo;this pod made a TCP connection to 1.2.3.4:80&amp;rdquo;. Tetragon tells you &amp;ldquo;this pod ran &lt;code>curl 1.2.3.4&lt;/code> from a &lt;code>bash&lt;/code> binary launched by &lt;code>pid 1234&lt;/code>&amp;rdquo;. Together they give you the full story.&lt;/p>
&lt;h2 id="deployment-and-operation">Deployment and operation&lt;/h2>
&lt;h3 id="helm">Helm&lt;/h3>
&lt;p>The canonical install with Helm:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">helm repo add cilium https://helm.cilium.io
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">helm install tetragon cilium/tetragon &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --namespace kube-system &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --set tetragon.exportFilename&lt;span class="o">=&lt;/span>/var/log/tetragon/tetragon.log &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --set tetragon.exportFileMaxSizeMB&lt;span class="o">=&lt;/span>&lt;span class="m">50&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --set tetragon.exportFileRotationInterval&lt;span class="o">=&lt;/span>24h
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Tetragon deploys its &lt;code>DaemonSet&lt;/code>, its CRDs and a service for Hubble. By default, it exposes the events on the agent pod&amp;rsquo;s &lt;code>stdout&lt;/code> (any cluster log aggregator picks them up).&lt;/p>
&lt;h3 id="the-tetra-cli">The &lt;code>tetra&lt;/code> CLI&lt;/h3>
&lt;p>Tetragon ships a CLI called &lt;code>tetra&lt;/code> for interactive investigation:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># real-time stream of the node&amp;#39;s events&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">tetra getevents -o compact --pods &amp;lt;pod-name&amp;gt;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># structured JSON events to process with jq&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">tetra getevents -o json --since 5m --namespace prod
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># view loaded policies&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">tetra tracingpolicy list
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>It is the best tool for debugging policies in &lt;code>monitoring&lt;/code> before moving them to &lt;code>enforce&lt;/code>.&lt;/p>
&lt;h3 id="exporting-to-a-siem">Exporting to a SIEM&lt;/h3>
&lt;p>Three usual routes:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>stdout + log aggregator&lt;/strong>: the agent writes JSON to stdout, Fluent Bit/Vector picks it up and sends it to Splunk/Datadog/Elastic. Simple, works with any logging infrastructure.&lt;/li>
&lt;li>&lt;strong>gRPC streaming&lt;/strong>: for low-latency integrations. A gRPC consumer of your own or Hubble Relay.&lt;/li>
&lt;li>&lt;strong>File + rotation&lt;/strong>: for air-gapped environments or regulatory audits that require persistent logs with controlled rotation.&lt;/li>
&lt;/ul>
&lt;h3 id="performance">Performance&lt;/h3>
&lt;p>Published benchmarks consistently place Tetragon at &lt;strong>&amp;lt;1% of the node&amp;rsquo;s CPU&lt;/strong> under real workloads, compared with &lt;strong>5-10% for Falco&lt;/strong> under the same workloads. The reason is the architectural separation: Tetragon filters in the kernel and only carries the events that actually matter to userspace; Falco carries every syscall to userspace and filters there. On clusters with thousands of pods making hundreds of thousands of syscalls per second, the difference shows up on the bill.&lt;/p>
&lt;h2 id="common-operational-traps">Common operational traps&lt;/h2>
&lt;h3 id="permanent-monitoring">Permanent &lt;code>monitoring&lt;/code>&lt;/h3>
&lt;p>The biggest trap is &lt;strong>never reaching &lt;code>enforce&lt;/code>&lt;/strong>: starting well with policies in monitoring, collecting events, tuning selectors, and then never switching. The result: you have detection without prevention, exactly what Falco gave you without paying Tetragon&amp;rsquo;s complexity. If you are going to use Tetragon, plan the road to enforce for the critical policies.&lt;/p>
&lt;h3 id="selectors-that-are-too-lax">Selectors that are too lax&lt;/h3>
&lt;p>A policy with a single &lt;code>matchActions: Post&lt;/code> and no specific selectors generates events for &lt;strong>every&lt;/strong> syscall of the chosen hook. On a serious node that means &lt;strong>tens of thousands per second&lt;/strong>, which fill logs, saturate exporters and hide the signal in the noise. Always start with strict filters (&lt;code>matchBinaries&lt;/code>, &lt;code>matchNamespaces&lt;/code>, &lt;code>matchPIDs&lt;/code>) and open up once you know what you are looking for.&lt;/p>
&lt;h3 id="a-kernel-that-is-too-old">A kernel that is too old&lt;/h3>
&lt;p>Tetragon needs modern eBPF features. Kernels &amp;lt; 5.4 do not have the large buffer support (needed for &lt;code>execve&lt;/code> with complete argv). Kernels &amp;lt; 5.10 do not have many of the LSM hooks. &lt;strong>Kernel 5.15+ is the recommended minimum for production&lt;/strong> and 6.1+ to have every feature.&lt;/p>
&lt;h3 id="hooks-on-renamed-kernel-functions">Hooks on renamed kernel functions&lt;/h3>
&lt;p>kprobes are tied to kernel function names that &lt;strong>can change between versions&lt;/strong>. A policy that uses &lt;code>__x64_sys_setns&lt;/code> can fail silently on a kernel where the function is called &lt;code>__do_sys_setns&lt;/code>. Solutions: use static tracepoints where they are available (more stable), or keep alternative policies with several &lt;code>call&lt;/code> entries for compatibility.&lt;/p>
&lt;h3 id="sigkill-in-critical-namespaces">&lt;code>Sigkill&lt;/code> in critical namespaces&lt;/h3>
&lt;p>Applying &lt;code>Sigkill&lt;/code> to processes in &lt;code>kube-system&lt;/code> or &lt;code>cilium-system&lt;/code> can break the cluster. Enforcement policies must &lt;strong>explicitly exclude&lt;/strong> the platform namespaces with &lt;code>matchNamespaces&lt;/code> Operator: &lt;code>NotIn&lt;/code>, or limit the scope with &lt;code>TracingPolicyNamespaced&lt;/code> to make sure they do not act on systems they should not.&lt;/p>
&lt;h3 id="missing-ratelimit">Missing &lt;code>rateLimit&lt;/code>&lt;/h3>
&lt;p>A policy without a rateLimit on &lt;code>Post&lt;/code> can suffer a catastrophic fan-out if the condition is met millions of times in an instant (typical in attack loops or application bugs). The agent saturates, events are lost, logs overflow. &lt;strong>Always put a sensible &lt;code>rateLimit&lt;/code> on detection policies&lt;/strong>, especially on high-frequency hooks such as &lt;code>tcp_connect&lt;/code> or &lt;code>execve&lt;/code>.&lt;/p>
&lt;h2 id="what-we-have-not-covered-upcoming-articles">What we have not covered (upcoming articles)&lt;/h2>
&lt;ul>
&lt;li>&lt;strong>eBPF LSM hooks&lt;/strong> in depth: how they relate to SELinux/AppArmor and when Tetragon is the right tool versus classic MAC.&lt;/li>
&lt;li>&lt;strong>Hubble UI with a Tetragon overlay&lt;/strong>: configuring the UI to show process observability and network observability on the same timeline.&lt;/li>
&lt;li>&lt;strong>Integration with OPA/Kyverno&lt;/strong>: how Tetragon complements admission policy engines (Kyverno validates at admission; Tetragon validates at runtime).&lt;/li>
&lt;li>&lt;strong>Forensics with eBPF&lt;/strong>: combining Tetragon with tools such as Beyla or OpenTelemetry to trace the full chain of an incident from the initial connection to the final syscall.&lt;/li>
&lt;/ul>
&lt;h2 id="references">References&lt;/h2>
&lt;p>Official documentation (May 2026):&lt;/p>
&lt;ul>
&lt;li>&lt;a href="https://tetragon.io/">Tetragon — official site&lt;/a> — entry point.&lt;/li>
&lt;li>&lt;a href="https://tetragon.io/docs/concepts/tracing-policy/">Tetragon docs — Tracing Policy&lt;/a> — conceptual reference.&lt;/li>
&lt;li>&lt;a href="https://tetragon.io/docs/concepts/tracing-policy/hooks/">Tetragon docs — Hook points&lt;/a> — kprobes, tracepoints, uprobes, LSM, USDT.&lt;/li>
&lt;li>&lt;a href="https://tetragon.io/docs/concepts/tracing-policy/selectors/">Tetragon docs — Selectors&lt;/a> — full filter reference.&lt;/li>
&lt;li>&lt;a href="https://tetragon.io/docs/concepts/tracing-policy/mode/">Tetragon docs — Enforcement Mode&lt;/a>.&lt;/li>
&lt;li>&lt;a href="https://tetragon.io/docs/concepts/tracing-policy/k8s-filtering/">Tetragon docs — Kubernetes Identity Aware Policies&lt;/a> — &lt;code>TracingPolicyNamespaced&lt;/code>.&lt;/li>
&lt;li>&lt;a href="https://github.com/cilium/tetragon">Tetragon GitHub&lt;/a>.&lt;/li>
&lt;/ul>
&lt;p>Comparisons and analysis:&lt;/p>
&lt;ul>
&lt;li>&lt;a href="https://www.scitepress.org/Papers/2025/142727/142727.pdf">Comparative Analysis of eBPF-Based Runtime Security Monitoring (SciTePress paper 2025)&lt;/a> — a benchmark with independent numbers.&lt;/li>
&lt;li>&lt;a href="https://www.armosec.io/blog/best-ebpf-security-solutions-runtime-protection/">Best eBPF Security Solutions for Kubernetes (ARMO, 2026)&lt;/a> — Falco vs Tetragon vs KubeArmor comparison.&lt;/li>
&lt;li>&lt;a href="https://medium.com/@mughal.asim/falco-vs-tetragon-a-runtime-security-showdown-for-kubernetes-a0e9fb9f30a0">Falco vs. Tetragon (Asim Mirza, Medium)&lt;/a> — analysis with use cases.&lt;/li>
&lt;li>&lt;a href="https://asecurityengineer.com/posts/deep-dive-into-tetragon/">Deep Dive into Tetragon (A Security Engineer)&lt;/a> — a walk through the inside of the agent.&lt;/li>
&lt;li>&lt;a href="https://medium.com/@mughal.asim/tetragon-series-part-2-enforcing-sensitive-file-access-with-a-namespaced-tracingpolicy-3c2f617ec912">Tetragon Series, Part 2: Enforcing Sensitive File Access (Medium)&lt;/a>.&lt;/li>
&lt;/ul>
&lt;p>Ecosystem:&lt;/p>
&lt;ul>
&lt;li>&lt;a href="https://docs.cilium.io/en/stable/observability/hubble/">Cilium Hubble — network observability&lt;/a>.&lt;/li>
&lt;li>&lt;a href="https://falco.org/">Falco — official site&lt;/a> — the other big name in the field.&lt;/li>
&lt;li>&lt;a href="https://kubearmor.io/">KubeArmor&lt;/a> — the third option, with AppArmor + eBPF.&lt;/li>
&lt;/ul>
&lt;p>Cross-references:&lt;/p>
&lt;ul>
&lt;li>Part 1 of the series: &lt;a href="https://blog.lo0.es/en/posts/ebpf-zero-to-cilium-kernel-tcp-ip-bypass/">eBPF from zero to Cilium: how the kernel learned to skip its own TCP/IP stack&lt;/a> — the eBPF fundamentals we take as read here.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/kubernetes-cilium-bgp-services-without-ingress/">Kubernetes with Cilium BGP: services reachable without Ingress&lt;/a> — the starting point of the Cilium ecosystem on this blog.&lt;/li>
&lt;/ul></description></item><item><title>eBPF from zero to Cilium: how the kernel learned to skip its own TCP/IP stack</title><link>https://blog.lo0.es/en/posts/ebpf-zero-to-cilium-kernel-tcp-ip-bypass/</link><pubDate>Tue, 19 May 2026 04:30:00 +0200</pubDate><guid>https://blog.lo0.es/en/posts/ebpf-zero-to-cilium-kernel-tcp-ip-bypass/</guid><description>&lt;h2 id="tldr">TL;DR&lt;/h2>
&lt;p>eBPF is &lt;strong>a sandboxed virtual machine inside the Linux kernel&lt;/strong> that runs verified code at well-defined hooks: kprobes, tracepoints, socket events, network drivers. Before eBPF, changing kernel behaviour meant recompiling it or loading an arbitrary module; with eBPF, you load a small program that passes a formal verifier and runs at native speed with memory safety. In networking, this translates into the fact that &lt;strong>the packet does not have to travel through the traditional TCP/IP stack&lt;/strong>: an eBPF program in the NIC driver (XDP) can drop, forward or rewrite the packet before the kernel has done its first alloc; a program on cgroup hooks (sock_ops) can redirect connections to another socket without the packet ever leaving the machine. Cilium is the CNI that has taken this to its logical conclusion: it &lt;strong>replaces kube-proxy with pure eBPF&lt;/strong> (O(1) instead of the O(N) of iptables), routes pod-to-pod without VXLAN where it can, evaluates Network Policies with BPF maps, and since 1.16 it has remade its BGP control plane with a new set of CRDs, &lt;code>CiliumBGPClusterConfig&lt;/code>, &lt;code>CiliumBGPPeerConfig&lt;/code>, &lt;code>CiliumBGPAdvertisement&lt;/code>, &lt;code>CiliumBGPNodeConfigOverride&lt;/code>, which replace the monolithic &lt;code>CiliumBGPPeeringPolicy&lt;/code> that is already deprecated. This post goes down the three layers (basic eBPF → eBPF networking → Cilium) and ends with the operational CRDs.&lt;/p>
&lt;h2 id="the-analogy-signed-plugins-for-the-kernel">The analogy: signed plugins for the kernel&lt;/h2>
&lt;p>Think of the browser. Twenty years ago, extending a browser meant compiling a native binary and loading it: any extension could crash it, corrupt memory, read your bank cookies. Today, extensions are &lt;strong>JavaScript in a sandbox&lt;/strong> with a manifest that declares permissions, a runtime that enforces the isolation and a store that signs the code. The extension does not touch the browser binary; it lives in a controlled world and can only talk to the browser through defined APIs. Result: massive extensibility with a bounded attack surface.&lt;/p>
&lt;p>eBPF is exactly that for the Linux kernel. Loading a classic &lt;code>.ko&lt;/code> module means loading native code with full access to kernel memory: one bug and the system is gone. eBPF is &lt;strong>a bytecode VM&lt;/strong> with a static verifier, a controlled allocator, JIT to native hardware after passing the verifier, and a set of kernel &amp;ldquo;helpers&amp;rdquo; it can call. The eBPF program can read the kernel memory the verifier allows it to read, and only that. It cannot enter infinite loops (the verifier demands that it terminate). It cannot jump to arbitrary addresses. It cannot dereference pointers without having validated them first. And, most importantly: &lt;strong>it is user code, loaded at runtime, executing inside the kernel at native speed&lt;/strong>.&lt;/p>
&lt;p>The consequences are visible from miles away. Before, observing traffic in production meant patching the kernel or loading a risky module. Today, &lt;code>bpftrace -e 'tracepoint:net:net_dev_xmit { @[args-&amp;gt;dev-&amp;gt;name] = count(); }'&lt;/code> gives you a histogram of packets per interface in three lines and zero downtime. Before, replacing iptables with something faster meant rewriting the netfilter subsystem. Today, Cilium loads 60 KB of eBPF bytecode into XDP and unseats iptables with a hash map.&lt;/p>
&lt;h2 id="basic-ebpf-what-it-is-and-what-it-is-not">Basic eBPF: what it is and what it is not&lt;/h2>
&lt;h3 id="the-origin-and-the-scope">The origin and the scope&lt;/h3>
&lt;p>The name comes from &lt;strong>Berkeley Packet Filter&lt;/strong>, a 1992 idea (McCanne and Jacobson) for filtering packets with a mini-bytecode that &lt;code>tcpdump&lt;/code> used internally. In 2014, Alexei Starovoitov renamed it &lt;strong>eBPF&lt;/strong> and extended it enormously: 11 64-bit registers instead of 2 32-bit ones, a 512-byte stack, maps as structures shared with userspace, JIT to native hardware, and a far more sophisticated formal verifier. From being a packet filter, it became &lt;strong>a generic kernel extensibility mechanism&lt;/strong>.&lt;/p>
&lt;p>Today eBPF is used for four things:&lt;/p>
&lt;ol>
&lt;li>&lt;strong>Networking&lt;/strong>: XDP, TC, cgroup hooks, socket ops, lightweight tunnels.&lt;/li>
&lt;li>&lt;strong>Observability&lt;/strong>: kprobes, uprobes, tracepoints, USDT. The basis of projects like &lt;code>bpftrace&lt;/code>, &lt;code>bcc&lt;/code>, Pixie, Parca.&lt;/li>
&lt;li>&lt;strong>Security&lt;/strong>: BPF LSM (Linux Security Module in eBPF), syscall blocking with seccomp-bpf. Falco, Tetragon, Tracee.&lt;/li>
&lt;li>&lt;strong>Scheduling&lt;/strong>: sched_ext (kernel 6.12+), process schedulers written entirely in eBPF. Still at a very early stage.&lt;/li>
&lt;/ol>
&lt;h3 id="the-vm">The VM&lt;/h3>
&lt;p>An eBPF program is compiled from C (or Rust, or Go with cilium/ebpf) to eBPF bytecode, not to x86/arm64 directly. The kernel loader (via the &lt;code>bpf()&lt;/code> syscall) passes that bytecode through &lt;strong>the verifier&lt;/strong>:&lt;/p>
&lt;ul>
&lt;li>It reconstructs the control flow graph.&lt;/li>
&lt;li>It performs static analysis of every possible path: every instruction has to be reachable, every memory access has to be within known bounds, every pointer has to have been validated.&lt;/li>
&lt;li>It rejects loops without a known upper bound. Recent kernels admit bounded loops (the &lt;code>bpf_loop&lt;/code> helper), but the counter is always finite.&lt;/li>
&lt;li>It rejects calls to helpers or kfuncs that the hook&amp;rsquo;s program type does not allow.&lt;/li>
&lt;/ul>
&lt;p>If the verifier accepts the program, the JIT translates it to the host&amp;rsquo;s native code (x86, arm64, etc.) and it stays attached to its hook. From then on it runs every time the hook&amp;rsquo;s event occurs, &lt;strong>with no context switch to userspace&lt;/strong>, &lt;strong>with no syscall cost&lt;/strong>. Latencies on the order of hundreds of nanoseconds per invocation.&lt;/p>
&lt;h3 id="maps-the-bridge-to-userspace">Maps: the bridge to userspace&lt;/h3>
&lt;p>An isolated eBPF program is not much use. What makes it useful are &lt;strong>maps&lt;/strong>: data structures shared between the kernel program and userspace. There are several types:&lt;/p>
&lt;ul>
&lt;li>&lt;code>BPF_MAP_TYPE_HASH&lt;/code>, &lt;code>BPF_MAP_TYPE_LRU_HASH&lt;/code>: hash tables with or without LRU eviction.&lt;/li>
&lt;li>&lt;code>BPF_MAP_TYPE_ARRAY&lt;/code>, &lt;code>BPF_MAP_TYPE_PERCPU_ARRAY&lt;/code>: arrays, optionally per-CPU to avoid contention.&lt;/li>
&lt;li>&lt;code>BPF_MAP_TYPE_RINGBUF&lt;/code>, &lt;code>BPF_MAP_TYPE_PERF_EVENT_ARRAY&lt;/code>: channels for streaming events to userspace.&lt;/li>
&lt;li>&lt;code>BPF_MAP_TYPE_PROG_ARRAY&lt;/code>: arrays of eBPF programs for tail calls (chaining programs without returning to the base kernel).&lt;/li>
&lt;/ul>
&lt;p>Userspace reads and writes these maps via &lt;code>bpf()&lt;/code> syscalls; the kernel program reads and writes them directly. It is the basis of any eBPF system: the kernel program collects data into a map, the userspace daemon reads it. Cilium does exactly this: the userland agent (Go) manages the policy and translates it into map entries; the eBPF programs living in XDP/TC read the maps and apply the decisions.&lt;/p>
&lt;h3 id="co-re-compile-once-run-on-any-kernel">CO-RE: compile once, run on any kernel&lt;/h3>
&lt;p>A classic nightmare of kernel modules: they are tied to the exact kernel version they were compiled against. Distributing a precompiled module for a fleet of machines with different distros was impossible.&lt;/p>
&lt;p>eBPF solves this with &lt;strong>CO-RE (Compile Once, Run Everywhere)&lt;/strong>: the bytecode includes &lt;strong>relocations&lt;/strong> that the loader resolves on each specific kernel by consulting &lt;strong>BTF (BPF Type Format)&lt;/strong>, a representation of the kernel&amp;rsquo;s struct layouts that the kernel itself publishes. Result: a single eBPF binary works on kernels 5.10, 5.15, 6.1 and 6.8 without recompiling, because the loader adjusts the struct access offsets at runtime.&lt;/p>
&lt;p>This is what has allowed productive eBPF distributions to exist. Without CO-RE, every kernel would be a porting project.&lt;/p>
&lt;h2 id="ebpf-in-networking-the-hooks-that-matter">eBPF in networking: the hooks that matter&lt;/h2>
&lt;p>Inside the Linux network subsystem, eBPF has several hooks. The ones relevant to CNIs:&lt;/p>
&lt;h3 id="xdp--express-data-path">XDP — eXpress Data Path&lt;/h3>
&lt;p>XDP is &lt;strong>the earliest hook&lt;/strong>: it runs in the NIC driver, &lt;strong>before the packet enters the kernel proper&lt;/strong>. There is no &lt;code>sk_buff&lt;/code> (the struct the rest of the kernel uses to represent packets); there is only a pointer to a RAM buffer with the received bytes.&lt;/p>
&lt;p>The actions an XDP program can return:&lt;/p>
&lt;ul>
&lt;li>&lt;code>XDP_DROP&lt;/code>: discard the packet immediately. The driver drops it and frees the buffer. Cost: nanoseconds. Use case: DDoS mitigation. Cloudflare processed &lt;strong>more than 8 million packets/second per CPU&lt;/strong> with XDP for dropping SYN floods.&lt;/li>
&lt;li>&lt;code>XDP_PASS&lt;/code>: let the packet continue to the normal kernel. It becomes an &lt;code>sk_buff&lt;/code> and enters the traditional stack.&lt;/li>
&lt;li>&lt;code>XDP_TX&lt;/code>: send it back out on the same interface after possible modifications. Useful for L4 load balancers that rewrite the destination and return it.&lt;/li>
&lt;li>&lt;code>XDP_REDIRECT&lt;/code>: send the packet to another interface or to a map (to forward to userspace via AF_XDP, or to another NIC, or to a pod&amp;rsquo;s veth).&lt;/li>
&lt;li>&lt;code>XDP_ABORTED&lt;/code>: error (increments a counter, drops).&lt;/li>
&lt;/ul>
&lt;p>Real use cases:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Cloudflare L3 DDoS protection&lt;/strong>: XDP rules that drop millions of packets/s.&lt;/li>
&lt;li>&lt;strong>Facebook Katran&lt;/strong>: an L4 load balancer that rewrites the destination IP and returns it on the same interface. Handles 10× more connections per server than classic IPVS.&lt;/li>
&lt;li>&lt;strong>Cilium XDP acceleration&lt;/strong>: Service load balancing at the lowest layer possible.&lt;/li>
&lt;/ul>
&lt;h3 id="tc-traffic-control--clsact-with-bpf">TC (Traffic Control) — clsact with BPF&lt;/h3>
&lt;p>XDP is very fast but limited: the packet does not have an &lt;code>sk_buff&lt;/code> yet and many decisions (conntrack, NAT, encapsulation with metadata) are easier when it does. The &lt;strong>TC clsact with BPF&lt;/strong> hook runs &lt;strong>after&lt;/strong> building the &lt;code>sk_buff&lt;/code> but &lt;strong>before&lt;/strong> the routing and netfilter decisions. Actions:&lt;/p>
&lt;ul>
&lt;li>&lt;code>TC_ACT_OK&lt;/code>: the packet continues through the stack.&lt;/li>
&lt;li>&lt;code>TC_ACT_SHOT&lt;/code>: drop.&lt;/li>
&lt;li>&lt;code>TC_ACT_REDIRECT&lt;/code>: redirect to another interface.&lt;/li>
&lt;li>&lt;code>TC_ACT_PIPE&lt;/code>, &lt;code>TC_ACT_STOLEN&lt;/code>: pipeline control for combining with other qdiscs.&lt;/li>
&lt;/ul>
&lt;p>Use cases:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Stateful network policy&lt;/strong>: Cilium evaluates L3-L7 policies in TC with the full &lt;code>sk_buff&lt;/code> and conntrack available.&lt;/li>
&lt;li>&lt;strong>Marking and QoS&lt;/strong>: traffic marking so the scheduler applies priorities.&lt;/li>
&lt;li>&lt;strong>Overlay encapsulation&lt;/strong>: adding VXLAN/Geneve headers when the mode is tunnel.&lt;/li>
&lt;/ul>
&lt;p>XDP and TC combine: &lt;strong>XDP for the cheap and early stuff&lt;/strong> (DDoS, simple LB), &lt;strong>TC for what needs an &lt;code>skb&lt;/code> and state&lt;/strong>.&lt;/p>
&lt;h3 id="cgroup-hooks-sock_ops-and-cgroup_sock_addr">Cgroup hooks: sock_ops and CGROUP_SOCK_ADDR&lt;/h3>
&lt;p>The most radical conceptual step: hooks that are not in the network layer but &lt;strong>in the socket layer&lt;/strong>. Relevant types:&lt;/p>
&lt;ul>
&lt;li>&lt;code>BPF_PROG_TYPE_CGROUP_SOCK_ADDR&lt;/code>: invoked when a process in a cgroup calls &lt;code>connect()&lt;/code>, &lt;code>bind()&lt;/code>, &lt;code>sendto()&lt;/code>. The eBPF program can &lt;strong>rewrite the destination address&lt;/strong> before the connection goes out. This is what lets Cilium do Service load balancing &lt;strong>without the packet entering the network stack&lt;/strong>: if the client tries to connect to &lt;code>10.96.0.1:443&lt;/code> (a ClusterIP), an eBPF program on this hook rewrites the destination to the real IP of the backend pod before the syscall continues.&lt;/li>
&lt;li>&lt;code>BPF_PROG_TYPE_SOCK_OPS&lt;/code>: invoked on TCP events (creation, established, retransmission). It allows tuning socket parameters at runtime and, most importantly, &lt;strong>pairing local sockets&lt;/strong> via &lt;code>bpf_sk_assign&lt;/code> to shortcut without the packet travelling over the network.&lt;/li>
&lt;/ul>
&lt;p>This is the &amp;ldquo;third layer&amp;rdquo; of the bypass: it is not just faster, it is &lt;strong>conceptually different&lt;/strong>. The packet is not built, not serialised, does not traverse the IP layer or the TCP layer. It is the difference between speeding up a road and discovering that for some journeys you do not need to take the car at all.&lt;/p>
&lt;h2 id="the-long-road-what-the-traditional-tcpip-stack-looks-like">The long road: what the traditional TCP/IP stack looks like&lt;/h2>
&lt;p>To appreciate what eBPF saves, it is worth tracing a packet&amp;rsquo;s full journey through the Linux stack. Take the case &amp;ldquo;packet arrives on a NIC, goes to a local process&amp;rdquo;:&lt;/p>
&lt;pre tabindex="0">&lt;code>NIC (DMA into the driver&amp;#39;s ring buffer)
↓
driver: napi_schedule, poll, allocates sk_buff
↓
[XDP hook] ← if there is an XDP program, it is decided here
↓
netif_receive_skb
↓
__netif_receive_skb_core
↓
[TC ingress clsact + BPF] ← if there is a TC ingress program
↓
packet_type handlers (IP, ARP...)
↓
ip_rcv → ip_rcv_core
↓
[netfilter NF_INET_PRE_ROUTING] ← iptables PREROUTING
↓
routing decision (FIB lookup)
↓
[netfilter NF_INET_LOCAL_IN] or [NF_INET_FORWARD]
↓
tcp_v4_rcv → tcp_v4_do_rcv
↓
tcp_rcv_established
↓
sk_data_ready
↓
process reads with recv()/read()
&lt;/code>&lt;/pre>&lt;p>Every arrow is a function call with a measurable cost. Every netfilter hook walks all the registered iptables/nftables rules. With kube-proxy in iptables mode and 5,000 Services × 10 endpoints each, there are on the order of &lt;strong>150,000 rules&lt;/strong> evaluated sequentially at &lt;code>NF_INET_PRE_ROUTING&lt;/code>. Published benchmarks show latencies of &lt;strong>tens of microseconds per packet&lt;/strong> in large Kubernetes clusters in the netfilter step alone, &lt;strong>before&lt;/strong> the application receives anything.&lt;/p>
&lt;p>And that is the normal path. On the way out the same thing happens in reverse: &lt;code>tcp_sendmsg → ip_output → NF_INET_LOCAL_OUT → routing → NF_INET_POSTROUTING → dev_queue_xmit → driver → NIC&lt;/code>.&lt;/p>
&lt;h2 id="how-cilium-skips-this-stack">How Cilium skips this stack&lt;/h2>
&lt;p>Cilium does not eliminate the TCP/IP stack; it is still there for the cases that need it. What it does is &lt;strong>shortcuts&lt;/strong> at the points where it hurts.&lt;/p>
&lt;h3 id="shortcut-1--xdp-for-the-service-datapath">Shortcut 1 — XDP for the Service datapath&lt;/h3>
&lt;p>For a cluster with 5,000 Services, kube-proxy iptables has an O(N) cost in evaluating rules (even with &lt;code>iptables-restore --noflush&lt;/code> and tricks, it is still linear in the number of chains the packet traverses).&lt;/p>
&lt;p>Cilium replaces it like this:&lt;/p>
&lt;ul>
&lt;li>Every Service and its endpoints live in &lt;strong>an eBPF hash map&lt;/strong>.&lt;/li>
&lt;li>When a packet comes in destined for a ClusterIP, Cilium&amp;rsquo;s XDP program does &lt;strong>an O(1) lookup&lt;/strong> in that map and obtains the backend endpoint.&lt;/li>
&lt;li>It rewrites the destination and does &lt;code>XDP_TX&lt;/code> (returns it on the same interface towards the backend) or &lt;code>XDP_REDIRECT&lt;/code> (sends it to the corresponding local pod&amp;rsquo;s veth).&lt;/li>
&lt;/ul>
&lt;p>This means the cost does not grow with the number of Services. 100 Services or 100,000, &lt;strong>constant lookup in the map&lt;/strong>. Published benchmarks show latency reductions of &lt;strong>30-50%&lt;/strong> in clusters with many Services compared with kube-proxy iptables, and of an order of magnitude compared with IPVS in some cases.&lt;/p>
&lt;h3 id="shortcut-2--socket-lb-the-packet-is-never-built">Shortcut 2 — socket-LB: the packet is never built&lt;/h3>
&lt;p>Cilium 1.6+ introduced &lt;strong>socket-level load balancing&lt;/strong>, based on cgroup hooks. It works like this:&lt;/p>
&lt;ul>
&lt;li>When a pod calls &lt;code>connect(10.96.0.1:443)&lt;/code> (a Service&amp;rsquo;s ClusterIP), the syscall enters the kernel.&lt;/li>
&lt;li>Before the kernel builds anything network-related, &lt;strong>an eBPF program on &lt;code>CGROUP_SOCK_ADDR/connect4&lt;/code>&lt;/strong> intercepts it and &lt;strong>rewrites the destination address&lt;/strong> to the real IP of the backend pod.&lt;/li>
&lt;li>The kernel carries on with the &lt;code>connect&lt;/code> as if the client had written &lt;code>10.0.0.42:8080&lt;/code> directly.&lt;/li>
&lt;/ul>
&lt;p>Why does it matter? Because when the backend pod is &lt;strong>on the same node&lt;/strong>, this shortcut turns a call that would have involved:&lt;/p>
&lt;pre tabindex="0">&lt;code>syscall connect → kernel stack → veth → bridge → veth → kernel stack → syscall accept
&lt;/code>&lt;/pre>&lt;p>into:&lt;/p>
&lt;pre tabindex="0">&lt;code>syscall connect (with the destination rewritten) → direct loopback
&lt;/code>&lt;/pre>&lt;p>The TCP/IP stack is literally avoided. There is no encapsulated packet, no journey through veth pairs, no netfilter. L7 pod-to-pod latencies on the same node drop to &lt;strong>local communication&lt;/strong> levels (~5-15 µs instead of ~30-50 µs for services with kube-proxy iptables and traditional veth).&lt;/p>
&lt;h3 id="shortcut-3--pod-to-pod-direct-routing">Shortcut 3 — pod-to-pod direct routing&lt;/h3>
&lt;p>The traditional overlay mode (Flannel, Calico VXLAN) encapsulates every pod-to-pod packet in VXLAN/Geneve. Every packet carries an extra 50-byte header, requires encap/decap, and consumes MTU.&lt;/p>
&lt;p>Cilium supports &lt;strong>direct routing&lt;/strong>: the pod CIDRs are advertised to the underlying fabric (with BGP, which is where the control plane we will look at comes in) and the physical routers route the pod-to-pod packets &lt;strong>without encapsulating&lt;/strong>. The packet leaves a pod with its original IP as source and the destination pod&amp;rsquo;s IP as dest, the node&amp;rsquo;s NIC hands it to the network, the network routes it, it arrives at the destination node and is delivered to the pod. Zero encap, full MTU, minimal latency.&lt;/p>
&lt;p>Cilium does this &lt;strong>via eBPF programs in TC&lt;/strong> that rewrite the necessary headers and decide whether the packet goes via encap or direct according to the policy configured per node.&lt;/p>
&lt;h3 id="shortcut-4--network-policy-in-tc-with-maps">Shortcut 4 — Network Policy in TC with maps&lt;/h3>
&lt;p>Network Policies in classic CNIs are usually translated into iptables rules, another factor that explodes linearly. Cilium evaluates them in eBPF programs that read &lt;strong>identity maps&lt;/strong>: every workload has a numeric identifier computed from its labels, and the policy is a map &lt;code>(src_identity, dst_identity, port, proto) → allow|deny&lt;/code>. One hash map lookup per packet.&lt;/p>
&lt;p>This also enables Cilium&amp;rsquo;s &lt;strong>L7 policies&lt;/strong> (HTTP, gRPC, Kafka filtering): the eBPF program recognises the L7 handshake, selectively redirects to the embedded Envoy proxy (which lives as a sidecar of the datapath, not as a pod sidecar) and only on that subset does it pay the cost of the L7 proxy. All the L3/L4 traffic stays on the eBPF fast path.&lt;/p>
&lt;h2 id="cilium-the-architecture">Cilium: the architecture&lt;/h2>
&lt;p>Cilium combines two planes:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Agent (Go)&lt;/strong>: lives as a DaemonSet on every node. It is the &amp;ldquo;slow&amp;rdquo; part: it translates the intent expressed in CRDs (CiliumNetworkPolicy, CiliumBGPClusterConfig, etc.) into entries in eBPF maps. It talks to the Kubernetes API server to discover endpoints, services, pods. It embeds a GoBGP for the BGP control plane. It embeds an Envoy for L7 policies.&lt;/li>
&lt;li>&lt;strong>Datapath (eBPF)&lt;/strong>: the programs loaded into XDP, TC, cgroup hooks. They are the &amp;ldquo;fast&amp;rdquo; part: they see every packet, read the maps the agent maintains, and decide in nanoseconds.&lt;/li>
&lt;/ul>
&lt;p>This separation is what makes Cilium operationally comfortable: the intent is expressed in YAML, the agent materialises it into maps, the maps are read by the datapath. If the agent goes down temporarily, the datapath keeps working with the last loaded configuration. As in any well-built control/data plane system.&lt;/p>
&lt;h2 id="bgp-control-plane-v2-the-crds-you-have-to-know">BGP Control Plane v2: the CRDs you have to know&lt;/h2>
&lt;p>Cilium has had BGP support for several years. The first version used a single monolithic CRD, &lt;code>CiliumBGPPeeringPolicy&lt;/code>, which mixed node configuration, peers, timers and advertisements into a single object. Since &lt;strong>Cilium 1.16&lt;/strong> there is &lt;strong>BGP Control Plane v2&lt;/strong>, which breaks that configuration into separate CRDs with clear responsibilities. &lt;code>CiliumBGPPeeringPolicy&lt;/code> (the &lt;code>cilium.io/v2alpha1&lt;/code> API) is &lt;strong>deprecated&lt;/strong> and migration warnings appear in the operator logs if you still use it.&lt;/p>
&lt;p>The new CRDs (the &lt;code>cilium.io/v2&lt;/code> API):&lt;/p>
&lt;h3 id="1-ciliumbgpclusterconfig">1. &lt;code>CiliumBGPClusterConfig&lt;/code>&lt;/h3>
&lt;p>Defines &lt;strong>BGP instances&lt;/strong> and the peers they connect to, from the cluster&amp;rsquo;s perspective. Which nodes apply this configuration is selected with a &lt;code>nodeSelector&lt;/code>.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-yaml" data-lang="yaml">&lt;span class="line">&lt;span class="cl">&lt;span class="nt">apiVersion&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">cilium.io/v2&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">kind&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">CiliumBGPClusterConfig&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">metadata&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">cilium-bgp-cluster&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">spec&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">nodeSelector&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">matchLabels&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">bgp-policy&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">rack-1 &lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c"># only nodes with this label&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">bgpInstances&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">instance-65000&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">localASN&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">65000&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">peers&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">top-of-rack-1a&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">peerASN&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">64512&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">peerAddress&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">10.0.1.1&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">peerConfigRef&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">tor-shared-config &lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c"># → reference to CiliumBGPPeerConfig&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">top-of-rack-1b&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">peerASN&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">64512&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">peerAddress&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">10.0.1.2&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">peerConfigRef&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">tor-shared-config&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>A BGP instance is the abstraction &amp;ldquo;this node takes part in BGP with this local ASN and these peers&amp;rdquo;. Several can coexist on the same node (multi-instance for multi-VRF).&lt;/p>
&lt;h3 id="2-ciliumbgppeerconfig">2. &lt;code>CiliumBGPPeerConfig&lt;/code>&lt;/h3>
&lt;p>Defines the &lt;strong>shared parameters&lt;/strong> of the peering: timers, address families, transport, MD5 password, graceful restart, etc. It is referenced from &lt;code>CiliumBGPClusterConfig&lt;/code> via &lt;code>peerConfigRef&lt;/code>. This avoids repeating the same configuration for every peer when there are dozens of them.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-yaml" data-lang="yaml">&lt;span class="line">&lt;span class="cl">&lt;span class="nt">apiVersion&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">cilium.io/v2&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">kind&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">CiliumBGPPeerConfig&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">metadata&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">tor-shared-config&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">spec&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">timers&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">holdTimeSeconds&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">30&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">keepAliveTimeSeconds&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">10&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">connectRetryTimeSeconds&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">5&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">gracefulRestart&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">enabled&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="kc">true&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">restartTimeSeconds&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">120&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">families&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">afi&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">ipv4&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">safi&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">unicast&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">advertisements&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">matchLabels&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">advertise&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">bgp &lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c"># → binds to CiliumBGPAdvertisement&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">afi&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">ipv6&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">safi&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">unicast&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">advertisements&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">matchLabels&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">advertise&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">bgp&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">authentication&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">password&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">bgp-md5-secret &lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c"># Secret with the MD5 password&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">key&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">password&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>A single &lt;code>CiliumBGPPeerConfig&lt;/code> can be referenced by &lt;strong>many different peers&lt;/strong>. You change timers or families in one place.&lt;/p>
&lt;h3 id="3-ciliumbgpadvertisement">3. &lt;code>CiliumBGPAdvertisement&lt;/code>&lt;/h3>
&lt;p>Declares &lt;strong>which prefixes are advertised&lt;/strong>: the node&amp;rsquo;s pod CIDRs, the ClusterIPs and ExternalIPs of Services, the IPs assigned by &lt;code>CiliumLoadBalancerIPPool&lt;/code> for type=LoadBalancer Services. They are bound to &lt;code>CiliumBGPPeerConfig&lt;/code> via labels.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-yaml" data-lang="yaml">&lt;span class="line">&lt;span class="cl">&lt;span class="nt">apiVersion&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">cilium.io/v2&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">kind&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">CiliumBGPAdvertisement&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">metadata&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">services-and-pods&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">labels&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">advertise&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">bgp &lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c"># ← the label the PeerConfig matches&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">spec&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">advertisements&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">advertisementType&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">PodCIDR &lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c"># advertises the node&amp;#39;s pod CIDR&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">attributes&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">communities&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">standard&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="s2">&amp;#34;65000:100&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">advertisementType&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">Service &lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c"># advertises ClusterIPs / LoadBalancer IPs&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">service&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">addresses&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="l">LoadBalancerIP&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="l">ClusterIP&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="l">ExternalIP&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">selector&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">matchLabels&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">bgp-advertise&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;true&amp;#34;&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c"># only Services with this label&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">attributes&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">communities&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">standard&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="s2">&amp;#34;65000:200&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">localPreference&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">200&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The granularity is very fine: you can advertise different types of prefixes with different BGP communities, different local-preference, different path attributes, and filter Services with label selectors. This was literally impossible with &lt;code>CiliumBGPPeeringPolicy&lt;/code> v1.&lt;/p>
&lt;h3 id="4-ciliumbgpnodeconfig-auto-generated">4. &lt;code>CiliumBGPNodeConfig&lt;/code> (auto-generated)&lt;/h3>
&lt;p>This CRD is not configured by hand. The &lt;strong>Cilium operator&lt;/strong> generates one per node from the &lt;code>CiliumBGPClusterConfig&lt;/code> that applies to that node. It is the materialised per-node state that each node&amp;rsquo;s agent reads to bring up its peerings. If you want to see what BGP configuration is actually running on a node, &lt;code>kubectl get ciliumbgpnodeconfig &amp;lt;nodename&amp;gt; -o yaml&lt;/code> shows you.&lt;/p>
&lt;h3 id="5-ciliumbgpnodeconfigoverride">5. &lt;code>CiliumBGPNodeConfigOverride&lt;/code>&lt;/h3>
&lt;p>Optional. It allows &lt;strong>overriding the generated configuration&lt;/strong> for a specific node when you need something non-standard. Use cases:&lt;/p>
&lt;ul>
&lt;li>Pinning the BGP router-id to a specific IP (useful when the node has several interfaces).&lt;/li>
&lt;li>Specifying the peer&amp;rsquo;s local address when there are several outgoing interfaces.&lt;/li>
&lt;li>Changing timers only for one problematic node.&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-yaml" data-lang="yaml">&lt;span class="line">&lt;span class="cl">&lt;span class="nt">apiVersion&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">cilium.io/v2&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">kind&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">CiliumBGPNodeConfigOverride&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">metadata&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">node-rack1-master01 &lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c"># the name must match the node&amp;#39;s&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">spec&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">bgpInstances&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">instance-65000&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">routerID&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">10.0.1.10&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c"># router-id override&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">peers&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">top-of-rack-1a&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">localAddress&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">10.0.1.10&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c"># specific local interface&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="relationship-diagram">Relationship diagram&lt;/h3>
&lt;div class="diagram" style="max-width:720px;margin:1.5rem auto;">
&lt;svg viewBox="0 0 720 320" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Relationship diagram between Cilium BGP v2 CRDs">
&lt;style>.title{font:600 13px sans-serif;fill:#222}.lbl{font:600 12px sans-serif;fill:#222}.sm{font:11px sans-serif;fill:#555}.box{stroke:#444;stroke-width:1.4}.c1{fill:#ffe9d6}.c2{fill:#d6eaff}.c3{fill:#d9f5d6}.c4{fill:#e9d6f5}.c5{fill:#eee;stroke-dasharray:4 2}.arr{stroke:#666;stroke-width:1.4;fill:none;marker-end:url(#h)}.dashed{stroke:#888;stroke-width:1.2;fill:none;stroke-dasharray:4 3;marker-end:url(#h)}&lt;/style>
&lt;defs>&lt;marker id="h" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6" markerHeight="6" orient="auto">&lt;path d="M0,0 L10,5 L0,10 z" fill="#666"/>&lt;/marker>&lt;/defs>
&lt;text x="360" y="22" text-anchor="middle" class="title">Cilium BGP Control Plane v2 CRDs and their relationships&lt;/text>
&lt;rect x="40" y="50" width="220" height="60" rx="6" class="box c1"/>
&lt;text x="150" y="74" text-anchor="middle" class="lbl">CiliumBGPClusterConfig&lt;/text>
&lt;text x="150" y="94" text-anchor="middle" class="sm">nodeSelector + bgpInstances&lt;/text>
&lt;rect x="290" y="50" width="180" height="60" rx="6" class="box c2"/>
&lt;text x="380" y="74" text-anchor="middle" class="lbl">CiliumBGPPeerConfig&lt;/text>
&lt;text x="380" y="94" text-anchor="middle" class="sm">timers, families, auth&lt;/text>
&lt;rect x="500" y="50" width="180" height="60" rx="6" class="box c3"/>
&lt;text x="590" y="74" text-anchor="middle" class="lbl">CiliumBGPAdvertisement&lt;/text>
&lt;text x="590" y="94" text-anchor="middle" class="sm">pod CIDR, Service IPs&lt;/text>
&lt;rect x="40" y="180" width="220" height="60" rx="6" class="box c5"/>
&lt;text x="150" y="204" text-anchor="middle" class="lbl">CiliumBGPNodeConfig&lt;/text>
&lt;text x="150" y="224" text-anchor="middle" class="sm">auto-generated by the operator&lt;/text>
&lt;rect x="290" y="180" width="220" height="60" rx="6" class="box c4"/>
&lt;text x="400" y="204" text-anchor="middle" class="lbl">CiliumBGPNodeConfigOverride&lt;/text>
&lt;text x="400" y="224" text-anchor="middle" class="sm">optional, by node name&lt;/text>
&lt;path class="arr" d="M260,80 L290,80"/>&lt;text x="275" y="74" text-anchor="middle" class="sm">peerConfigRef&lt;/text>
&lt;path class="dashed" d="M380,110 L380,150 L470,180"/>&lt;text x="425" y="155" text-anchor="middle" class="sm">binds via labels&lt;/text>
&lt;path class="arr" d="M590,110 L590,150 L500,180"/>&lt;text x="545" y="155" text-anchor="middle" class="sm">advertisements&lt;/text>
&lt;path class="arr" d="M150,110 L150,180"/>&lt;text x="165" y="150" text-anchor="middle" class="sm">operator&lt;/text>
&lt;path class="dashed" d="M290,210 L260,210"/>&lt;text x="275" y="205" text-anchor="middle" class="sm">override&lt;/text>
&lt;text x="360" y="290" text-anchor="middle" class="sm">solid arrows: direct YAML references. Dashed: links by label selector or lateral coordination.&lt;/text>
&lt;/svg>
&lt;/div>
&lt;h3 id="ciliumloadbalancerippool-it-complements-it-is-not-bgp">CiliumLoadBalancerIPPool: it complements, it is not BGP&lt;/h3>
&lt;p>Although it is not strictly a BGP CRD, it is worth mentioning: &lt;strong>&lt;code>CiliumLoadBalancerIPPool&lt;/code>&lt;/strong> is the CRD that supplies IPs to type=LoadBalancer Services. It defines a range (&lt;code>10.20.0.0/24&lt;/code>, for example) that Cilium assigns automatically to LoadBalancer Services. Combined with a &lt;code>CiliumBGPAdvertisement&lt;/code> that advertises &lt;code>LoadBalancerIP&lt;/code>, it gives the complete cycle: new Service → IP assigned from the pool → BGP advertisement to the routers → IP routable from the corporate network, with no external balancer.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-yaml" data-lang="yaml">&lt;span class="line">&lt;span class="cl">&lt;span class="nt">apiVersion&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">cilium.io/v2alpha1&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">kind&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">CiliumLoadBalancerIPPool&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">metadata&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">lb-pool-rack1&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">spec&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">blocks&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">start&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;10.20.0.10&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">stop&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;10.20.0.250&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">serviceSelector&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">matchLabels&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">lb-pool&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">rack1&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="full-manifest-pod-cidrs--loadbalancer-services-advertised-to-a-redundant-tor-pair">Full manifest: pod CIDRs + LoadBalancer Services advertised to a redundant ToR pair&lt;/h2>
&lt;p>A realistic example of a cluster with two top-of-rack switches as BGP peers, both in the same AS (64512), Cilium in AS 65000:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-yaml" data-lang="yaml">&lt;span class="line">&lt;span class="cl">&lt;span class="c"># 1. CiliumBGPPeerConfig — shared config for both ToRs&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nn">---&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">apiVersion&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">cilium.io/v2&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">kind&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">CiliumBGPPeerConfig&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">metadata&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">tor-peers&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">spec&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">timers&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">holdTimeSeconds&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">30&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">keepAliveTimeSeconds&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">10&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">gracefulRestart&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">enabled&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="kc">true&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">restartTimeSeconds&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">120&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">families&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">afi&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">ipv4&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">safi&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">unicast&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">advertisements&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">matchLabels&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">advertise&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">bgp&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="c"># 2. CiliumBGPAdvertisement — what gets advertised&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nn">---&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">apiVersion&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">cilium.io/v2&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">kind&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">CiliumBGPAdvertisement&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">metadata&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">pods-and-lb&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">labels&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">advertise&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">bgp&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">spec&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">advertisements&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">advertisementType&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">PodCIDR&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">advertisementType&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">Service&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">service&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">addresses&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="l">LoadBalancerIP]&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">selector&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">matchExpressions&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- {&lt;span class="w"> &lt;/span>&lt;span class="nt">key: io.kubernetes.service.namespace, operator: NotIn, values&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="l">kube-system] }&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="c"># 3. CiliumBGPClusterConfig — which nodes talk to which peers&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nn">---&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">apiVersion&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">cilium.io/v2&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">kind&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">CiliumBGPClusterConfig&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">metadata&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">cluster-bgp&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">spec&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">nodeSelector&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">matchLabels&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">bgp&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">enabled&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">bgpInstances&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">instance-65000&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">localASN&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">65000&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">peers&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">tor-a&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">peerASN&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">64512&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">peerAddress&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">10.0.1.1&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">peerConfigRef&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>{&lt;span class="w"> &lt;/span>&lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">tor-peers }&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">tor-b&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">peerASN&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">64512&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">peerAddress&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">10.0.1.2&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">peerConfigRef&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>{&lt;span class="w"> &lt;/span>&lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">tor-peers }&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="c"># 4. CiliumLoadBalancerIPPool — range of LB IPs&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nn">---&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">apiVersion&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">cilium.io/v2alpha1&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">kind&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">CiliumLoadBalancerIPPool&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">metadata&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">name&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">lb-corporate&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">spec&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">blocks&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">cidr&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;10.20.0.0/24&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Four objects. Before, in v1, it was a single &lt;code>CiliumBGPPeeringPolicy&lt;/code> that mixed everything together and turned out to be hard to maintain in clusters of more than 5 nodes with heterogeneous configuration. The new separation is longer but clearly factorable: one &lt;code>PeerConfig&lt;/code> per peer type, one &lt;code>Advertisement&lt;/code> per advertisement policy, one &lt;code>ClusterConfig&lt;/code> connecting nodes with peers.&lt;/p>
&lt;h2 id="common-operational-traps">Common operational traps&lt;/h2>
&lt;h3 id="routingmode-tunnel-mode-with-bgp">&lt;code>routingMode: tunnel&lt;/code> mode with BGP&lt;/h3>
&lt;p>BGP only makes sense with &lt;strong>direct routing&lt;/strong> (&lt;code>routingMode: native&lt;/code>). If you have tunnel mode (VXLAN/Geneve) and configure BGP, you will advertise pod CIDRs but the packets will still go out encapsulated, producing confusing behaviour (sometimes via tunnel, sometimes direct depending on routes). Configure &lt;code>routingMode: native&lt;/code> and disable the tunnel.&lt;/p>
&lt;h3 id="ebpf-host-routing-vs-kube-proxy-replacement">eBPF host routing vs &lt;code>kube-proxy replacement&lt;/code>&lt;/h3>
&lt;p>They are two different things. &lt;code>kubeProxyReplacement: true&lt;/code> enables the replacement of kube-proxy (the Services). &lt;code>bpf.hostRouting: true&lt;/code> enables the host&amp;rsquo;s iptables bypass (the node&amp;rsquo;s routing decisions are made with eBPF instead of the traditional FIB). The second needs kernel 5.10+ with all the bpf features enabled; if you do not have that kernel, it falls back to legacy mode and the performance is only &amp;ldquo;almost as good&amp;rdquo;.&lt;/p>
&lt;h3 id="aggressive-bgp-timers-over-flapping-nics">Aggressive BGP timers over flapping NICs&lt;/h3>
&lt;p>With &lt;code>holdTimeSeconds: 9 / keepAliveSeconds: 3&lt;/code>, a NIC that blinks for 5 seconds breaks the BGP session and all the advertised routes disappear from the fabric. That node&amp;rsquo;s pods become unreachable until the session is re-established. For clusters on hardware with suspect NICs, use the conservative values (&lt;code>holdTime: 30, keepAlive: 10&lt;/code>) and consider &lt;strong>graceful restart&lt;/strong> explicitly (it is already in the example above).&lt;/p>
&lt;h3 id="advertising-clusterip-to-the-corporate-network">Advertising ClusterIP to the corporate network&lt;/h3>
&lt;p>Advertising &lt;code>ClusterIP&lt;/code> to external routers is &lt;strong>rarely what you want&lt;/strong>: these are internal Service IPs, not designed to be reached from outside the cluster. For external exposure, use &lt;code>LoadBalancerIP&lt;/code> from a &lt;code>CiliumLoadBalancerIPPool&lt;/code>. Advertising &lt;code>ClusterIP&lt;/code> only makes sense in very specific topologies (multi-cluster mesh with shared service discovery).&lt;/p>
&lt;h3 id="mixing-v2alpha1-ciliumbgppeeringpolicy-and-v2-ciliumbgpclusterconfig">Mixing v2alpha1 (&lt;code>CiliumBGPPeeringPolicy&lt;/code>) and v2 (&lt;code>CiliumBGPClusterConfig&lt;/code>)&lt;/h3>
&lt;p>It does not work well. The operator emits warnings in the logs about the use of the deprecated API, and conflicts between what the peering policy defines and what the cluster config defines can produce strange states. Migrate from one to the other in a single pass; do not run both.&lt;/p>
&lt;h3 id="md5-password-and-mtu">MD5 password and MTU&lt;/h3>
&lt;p>If you configure an MD5 password in &lt;code>CiliumBGPPeerConfig.authentication&lt;/code>, the TCP header is larger. On links with a tight MTU (1500 - 50 for the upstream fabric&amp;rsquo;s VXLAN, for example), the BGP handshake can fragment and die silently. Either use MTU 9000 between nodes and ToR, or make sure the MSS values are negotiated correctly.&lt;/p>
&lt;h2 id="what-we-have-not-covered">What we have not covered&lt;/h2>
&lt;ul>
&lt;li>&lt;strong>Cilium Cluster Mesh&lt;/strong>: federation of several Cilium clusters so their Services can see each other. It fits with BGP when you want native routing between clusters; it has its own CRDs.&lt;/li>
&lt;li>&lt;strong>L7 Policies and the embedded Envoy&lt;/strong>: HTTP/gRPC/Kafka policy. Another layer of eBPF + proxy that deserves its own post.&lt;/li>
&lt;li>&lt;strong>Hubble&lt;/strong>: eBPF-based traffic observability that Cilium exposes. Flow log dashboards with zero impact on latency.&lt;/li>
&lt;li>&lt;strong>Transparent WireGuard&lt;/strong>: pod-to-pod encryption without sidecars, controlled by Cilium via eBPF redirect to a kernel WireGuard dataplane.&lt;/li>
&lt;li>&lt;strong>Gateway API in Cilium&lt;/strong>: the successor to Ingress, with first-class support since Cilium 1.16+.&lt;/li>
&lt;li>&lt;strong>eBPF for LLM serving&lt;/strong>: the natural connection with the previous inference series. There is recent work using eBPF for multi-tenant fairness on GPUs and for token tracking; paper territory, not production yet.&lt;/li>
&lt;/ul>
&lt;p>In other words, there is material left for another three posts in today&amp;rsquo;s series. Let us take them in order.&lt;/p>
&lt;h2 id="references">References&lt;/h2>
&lt;p>Conceptual and project:&lt;/p>
&lt;ul>
&lt;li>&lt;a href="https://ebpf.io/">eBPF.io&lt;/a> — canonical documentation of the eBPF ecosystem.&lt;/li>
&lt;li>&lt;a href="https://github.com/iovisor/bcc">The BPF Compiler Collection (bcc)&lt;/a> and &lt;a href="https://github.com/bpftrace/bpftrace">bpftrace&lt;/a> — tools to get started with.&lt;/li>
&lt;li>&lt;a href="https://www.programming-helper.com/tech/ebpf-2026-extended-berkeley-packet-filter-observability-security">eBPF en 2026: How Extended Berkeley Packet Filter Became the Engine of Linux Observability and Networking&lt;/a> — state of the art.&lt;/li>
&lt;/ul>
&lt;p>XDP, TC and firewalling:&lt;/p>
&lt;ul>
&lt;li>&lt;a href="https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/10/html/configuring_firewalls_and_packet_filters/getting-started-with-xdp-and-ebpf">Getting started with XDP and eBPF (Red Hat docs)&lt;/a>.&lt;/li>
&lt;li>&lt;a href="https://medium.com/@majidbasharat21/full-guide-to-bpf-firewalls-xdp-tc-and-ebpf-integration-81951f19354b">Full Guide to BPF Firewalls: XDP, tc, and eBPF Integration (Medium, 2025)&lt;/a>.&lt;/li>
&lt;li>&lt;a href="https://blog.cloudflare.com/xdp-on-bpf-and-bonding/">Cloudflare blog: XDP for DDoS mitigation&lt;/a>.&lt;/li>
&lt;li>&lt;a href="https://github.com/facebookincubator/katran">Facebook Katran (GitHub)&lt;/a> — L4 LB with XDP, code and paper.&lt;/li>
&lt;/ul>
&lt;p>Cilium:&lt;/p>
&lt;ul>
&lt;li>&lt;a href="https://docs.cilium.io/">Cilium documentation&lt;/a> — always the first port of call.&lt;/li>
&lt;li>&lt;a href="https://docs.cilium.io/en/stable/network/kubernetes/kubeproxy-free/">Kubernetes Without kube-proxy&lt;/a> — the official guide to the replacement.&lt;/li>
&lt;li>&lt;a href="https://docs.cilium.io/en/stable/network/bgp-control-plane/bgp-control-plane-configuration/">Cilium BGP Control Plane Resources (docs)&lt;/a> — reference for the v2 CRDs.&lt;/li>
&lt;li>&lt;a href="https://oneuptime.com/blog/post/2026-03-13-cilium-bgp-control-plane-configuration/view">Configuring Cilium BGP Control Plane (OneUptime blog, mar 2026)&lt;/a> — walkthrough.&lt;/li>
&lt;li>&lt;a href="https://sigridjin.medium.com/a-guide-to-bgp-control-plane-and-cluster-mesh-in-cilium-networking-f20dbf64c5ed">A Guide to BGP Control Plane and Cluster Mesh in Cilium Networking (Sigrid Jin, Medium)&lt;/a> — a deeper post with use cases.&lt;/li>
&lt;/ul>
&lt;p>Cross-references:&lt;/p>
&lt;ul>
&lt;li>Previous post on this blog: &lt;a href="https://blog.lo0.es/en/posts/kubernetes-cilium-bgp-services-without-ingress/">Kubernetes with Cilium BGP: services reachable without Ingress&lt;/a> — the first step, with version v1 (which now needs migrating).&lt;/li>
&lt;li>Series on LLM inference: &lt;a href="https://blog.lo0.es/en/posts/kv-cache-working-memory-llm-inference/">KV cache&lt;/a>, &lt;a href="https://blog.lo0.es/en/posts/vllm-kubernetes-llm-inference-that-scales/">vLLM on Kubernetes&lt;/a>, &lt;a href="https://blog.lo0.es/en/posts/pagedattention-vllm-block-manager/">PagedAttention deep dive&lt;/a>, &lt;a href="https://blog.lo0.es/en/posts/llm-inference-operators-kubernetes/">LLM K8s Operators&lt;/a> — where the fast network (which we will see in the following posts of this series) determines real performance.&lt;/li>
&lt;/ul></description></item></channel></rss>