This specification is maintained by the AgentRules Working Group. Have enhancements or want to claim maintainership?Submit Specification →
devopscritical PriorityID: cilium-ebpf-tetragon-runtime-enforcement

Kernel-Level eBPF Cilium Service Mesh & Tetragon Runtime Guardrail

Mandates sidecar-free service mesh architecture leveraging Cilium eBPF for L7 traffic routing and Tetragon TracingPolicies for un-bypassable kernel-level syscall runtime enforcement. Eliminates user-space proxy latency and resource bloat while securing execution vectors directly inside the Linux kernel.

Prohibited Anti-Pattern: Relying on User-Space Sidecar Proxies and Auditd/Seccomp Bypassable Daemon Monitoring

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Kernel-Level eBPF Cilium Service Mesh & Tetragon Runtime Guardrail - Mandates sidecar-free service mesh architecture leveraging Cilium eBPF for L7 traffic routing and Tetragon TracingPolicies for un-bypassable kernel-level syscall runtime enforcement. Eliminates user-space proxy latency and resource bloat while securing execution vectors directly inside the Linux kernel.
globs: deploy/**/*.yaml, k8s/**/*.yaml, charts/**/*.yaml, policies/**/*.yaml, infra/**/*.tf
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/cilium-ebpf-tetragon-runtime-enforcement"
---

# Kernel-Level eBPF Cilium Service Mesh & Tetragon Runtime Guardrail

> **Severity**: CRITICAL | **Category**: devops
> **Anti-Pattern Warning**: Relying on User-Space Sidecar Proxies and Auditd/Seccomp Bypassable Daemon Monitoring

## System Constraints
You are a Principal Security & Infrastructure Architect specializing in Linux eBPF, Cilium Service Mesh, and Tetragon runtime enforcement. Mandate sidecar-free L7 service mesh routing, socket-layer acceleration via sockops, and in-kernel real-time process execution prevention (SIGKILL) on unauthorized syscalls. Forbid legacy user-space sidecar injections and blind reliance on user-space log forwarders for intrusion detection.

## Strict Guidelines
- Engineers MUST ALWAYS enforce L7 traffic policies and mTLS using CiliumNetworkPolicy (CNP) and Cilium Clusterwide Network Policy (CCNP) operating at the eBPF layer instead of injecting user-space Envoy sidecar containers.
- Engineers MUST NOT introduce container sidecars that replicate proxy functionality (e.g., Envoy/Istio sidecars) when Cilium eBPF host routing and Gateway API can achieve sub-millisecond socket-level redirection.
- Security engineers MUST deploy Tetragon TracingPolicy CRDs targeting kernel syscalls (e.g., sys_enter_execve, sys_enter_openat) with explicit in-kernel 'Sigkill' actions against unauthorized shell execution or sensitive path access.
- Policies MUST explicitly monitor and restrict process namespace pivots (setns, unshare) and unauthorized privilege escalations (commit_creds, cap_capable) at the kernel boundary.
- Network policies MUST define explicit L7 rules (HTTP/gRPC methods, endpoints, Kafka topics) and deny all implicitly unauthorized cross-namespace egress traffic at the eBPF layer.

## Bad vs Good Implementations
### Tetragon TracingPolicy with In-Kernel SIGKILL on Interactive Shell Executions

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Relies on user-space proxy injection which consumes extra pod resources and fails to stop zero-day execution vectors inside the container in real time (attacker can execute shells before audit alerts trigger).
```yaml
# Anti-pattern: Relying on post-execution user-space container logging without runtime kernel termination
apiVersion: v1
kind: Pod
metadata:
  name: payment-service
  annotations:
    # Inefficient: introduces memory bloat, high latency, and bypassable networking
    sidecar.istio.io/inject: "true"
spec:
  containers:
    - name: app
      image: payment-service:v1.2.0
      securityContext:
        allowPrivilegeEscalation: true
```

#### Production Standard (Correct)
> **Standard**: Enforces deterministic, un-bypassable kernel-level execution prevention via Tetragon's Sigkill action on unauthorized shell spawns, combined with Cilium eBPF L7 network verification without sidecar overhead.
```yaml
# Production Standard: Sidecar-free deployment secured by in-kernel Tetragon TracingPolicy with instant SIGKILL
apiVersion: cilium.io/v1alpha1
kind: TracingPolicy
metadata:
  name: block-shell-execution-payment
  namespace: payments
spec:
  kprobes:
    - call: "sys_execve"
      syscall: true
      args:
        - index: 0
          type: "string"
      selectors:
        - matchArgs:
            - index: 0
              operator: "Prefix"
              values:
                - "/bin/sh"
                - "/bin/bash"
                - "/usr/bin/sh"
                - "/usr/bin/bash"
          matchNamespaces:
            - payments
          matchActions:
            - action: Sigkill
---
apiVersion: "cilium.io/v2"
kind: CiliumNetworkPolicy
metadata:
  name: secure-payment-egress
  namespace: payments
spec:
  endpointSelector:
    matchLabels:
      app: payment-service
  egress:
    - toEndpoints:
        - matchLabels:
            app: ledger-service
      toPorts:
        - ports:
            - port: "8443"
              protocol: TCP
          rules:
            http:
              - method: "POST"
                path: "/v1/ledger/commit"
```

Architectural Specification & Invariant Rationale

Architectural Invariant Design: Kernel-Level eBPF Cilium Service Mesh & Tetragon Runtime Guardrail

Kernel-Level eBPF Cilium Service Mesh & Tetragon Runtime Guardrail defines an industrial-grade behavioral standard for devops engineering. Mandates sidecar-free service mesh architecture leveraging Cilium eBPF for L7 traffic routing and Tetragon TracingPolicies for un-bypassable kernel-level syscall runtime enforcement. Eliminates user-space proxy latency and resource bloat while securing execution vectors directly inside the Linux kernel. Modern software architectures require strict adherence to deterministic patterns to guarantee high availability, maintainability, and zero security vulnerabilities.

Framework Paradigm Shift & Drift MechanicsLLMs are trained on millions of open-source repositories containing outdated code, legacy idioms, and unpatched antipatterns. When coding assistants generate implementations for this stack, they default to common statistical tokens: Relying on User-Space Sidecar Proxies and Auditd/Seccomp Bypassable Daemon Monitoring Without an explicit system instruction file, developers spend hours debugging silent failures.
Failure Modes & Production Blast Radius

Hazard Analysis: What Breaks Without This Rule

The following failure modes have been cataloged from hundreds of hours of production code reviews where AI assistants produced non-compliant implementations:

Failure ModeAI Symptom (The Anti-Pattern)SeverityProduction Impact & Remedy
AI Hallucination & Deprecation DriftRelying on User-Space Sidecar Proxies and Auditd/Seccomp Bypassable Daemon MonitoringCritical
Violating this industrial standard introduces regression bugs, security risks, and unexpected runtime failures in production.
Enforce explicit behavioral system directives across all AI coding assistants in your repository.
Silent Architecture InconsistencyAI assistants produce mixed paradigms across files, creating fragmented codebase conventions.Medium
Increases cognitive load during code reviews and leads to maintenance debt across engineering teams.
Pin project conventions in .cursor/rules, CLAUDE.md, and AGENTS.md so all team agents follow identical guardrails.
Architectural Directives in Detail

Step-by-Step Production Directives

Each rule constraint below is injected into the AI agent's system prompt to establish deterministic boundaries:

1

Engineers MUST ALWAYS enforce L7 traffic policies and mTLS using CiliumNetworkPolicy (CNP) and Cilium Clusterwide Network Policy (CCNP) operating at the eBPF layer instead of injecting user-space Envoy sidecar containers.

Engineers MUST ALWAYS enforce L7 traffic policies and mTLS using CiliumNetworkPolicy (CNP) and Cilium Clusterwide Network Policy (CCNP) operating at the eBPF layer instead of injecting user-space Envoy sidecar containers.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
2

Engineers MUST NOT introduce container sidecars that replicate proxy functionality (e.g., Envoy/Istio sidecars) when Cilium eBPF host routing and Gateway API can achieve sub-millisecond socket-level redirection.

Engineers MUST NOT introduce container sidecars that replicate proxy functionality (e.g., Envoy/Istio sidecars) when Cilium eBPF host routing and Gateway API can achieve sub-millisecond socket-level redirection.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
3

Security engineers MUST deploy Tetragon TracingPolicy CRDs targeting kernel syscalls (e.g., sys_enter_execve, sys_enter_openat) with explicit in-kernel 'Sigkill' actions against unauthorized shell execution or sensitive path access.

Security engineers MUST deploy Tetragon TracingPolicy CRDs targeting kernel syscalls (e.g., sys_enter_execve, sys_enter_openat) with explicit in-kernel 'Sigkill' actions against unauthorized shell execution or sensitive path access.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
4

Policies MUST explicitly monitor and restrict process namespace pivots (setns, unshare) and unauthorized privilege escalations (commit_creds, cap_capable) at the kernel boundary.

Policies MUST explicitly monitor and restrict process namespace pivots (setns, unshare) and unauthorized privilege escalations (commit_creds, cap_capable) at the kernel boundary.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
5

Network policies MUST define explicit L7 rules (HTTP/gRPC methods, endpoints, Kafka topics) and deny all implicitly unauthorized cross-namespace egress traffic at the eBPF layer.

Network policies MUST define explicit L7 rules (HTTP/gRPC methods, endpoints, Kafka topics) and deny all implicitly unauthorized cross-namespace egress traffic at the eBPF layer.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
Technical Questions & Answers

Frequently Asked Technical Questions

Common questions developers face when configuring AI coding assistants for this stack:

Q:Why is Kernel-Level eBPF Cilium Service Mesh & Tetragon Runtime Guardrail critical for AI coding assistants?

Mandates sidecar-free service mesh architecture leveraging Cilium eBPF for L7 traffic routing and Tetragon TracingPolicies for un-bypassable kernel-level syscall runtime enforcement. Eliminates user-space proxy latency and resource bloat while securing execution vectors directly inside the Linux kernel. Without explicit behavioral boundaries, AI coding assistants (Cursor, Claude Code, Windsurf, Codex) rely on training data averages, which frequently produce deprecated, inefficient, or vulnerable code patterns.

Q:How does adopting this rule prevent AI hallucinations?

This rule explicitly declares what the AI must avoid (Relying on User-Space Sidecar Proxies and Auditd/Seccomp Bypassable Daemon Monitoring) and prescribes verified positive examples. Grounding the LLM with negative and positive pairs eliminates guesswork.

Q:Which AI coding environments are supported?

This specification is multi-platform compatible: Cursor (.cursor/rules/*.mdc & .cursorrules), Anthropic Claude Code (CLAUDE.md), Windsurf (.windsurfrules), Codex / Cline (AGENTS.md), and GitHub Copilot (.github/copilot-instructions.md).

Q:Can I combine this rule with other technology stacks?

Yes. Use the Interactive Stack Builder or download an Agent Pack to merge this rule with other frontend, backend, database, security, and DevOps rules without syntax collision.

Open Specification · CC BY 4.0·Free for Personal, Team & Commercial In-Repo Use

Citation & Open Source Attribution Guidelines

This specification is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0). You are completely free to adapt and share this rule in your workspace. If citing, including in public AI benchmark datasets, or redistributing, attribution to AgentRules.org is required.

1 Rule in Stack

Kernel-Level