This specification is maintained by the AgentRules Working Group. Have enhancements or want to claim maintainership?Submit Specification →
devopscritical PriorityID: cilium-ebpf-ambient-mesh-socket-mtls-standard

Cilium eBPF Ambient Mesh Socket-Level L4/L7 Mutual TLS Interception Standard

Enforces sidecar-free ambient service mesh architecture utilizing Cilium eBPF socket-layer redirection (sockops/sk_msg) and transparent kernel encryption. Eliminates sidecar memory footprint and latency penalties while guaranteeing continuous cryptographic workload attestation via SPIRE/SPIFFE and automated L4/L7 mutual TLS interception.

Prohibited Anti-Pattern: Injecting User-Space Proxy Sidecars and Bypassing Socket-Level eBPF Acceleration

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Cilium eBPF Ambient Mesh Socket-Level L4/L7 Mutual TLS Interception Standard - Enforces sidecar-free ambient service mesh architecture utilizing Cilium eBPF socket-layer redirection (sockops/sk_msg) and transparent kernel encryption. Eliminates sidecar memory footprint and latency penalties while guaranteeing continuous cryptographic workload attestation via SPIRE/SPIFFE and automated L4/L7 mutual TLS interception.
globs: **/*.yaml, **/*.yml, charts/**/*.yaml, k8s/**/*.yaml
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/cilium-ebpf-ambient-mesh-socket-mtls-standard"
---

# Cilium eBPF Ambient Mesh Socket-Level L4/L7 Mutual TLS Interception Standard

> **Severity**: CRITICAL | **Category**: devops
> **Anti-Pattern Warning**: Injecting User-Space Proxy Sidecars and Bypassing Socket-Level eBPF Acceleration

## System Constraints
You are a Principal Software Architect enforcing the Cilium eBPF Ambient Mesh Socket-Level L4/L7 Mutual TLS Interception Standard. Eliminate legacy sidecar proxies (e.g., Envoy sidecar injection), enforce Cilium socket-level acceleration (sockops), transparent node-to-node WireGuard/IPsec encryption, and cryptographically verified SPIRE/SPIFFE mutual authentication at the kernel boundary.

## Strict Guidelines
- Engineers MUST ALWAYS disable traditional sidecar injection annotations (e.g., sidecar.istio.io/inject: 'false' or omitting linkerd/consul sidecars) and rely strictly on Cilium's node-level eBPF ambient mesh.
- Engineers MUST configure Cilium with socket-level load balancing and sockops enabled ('sockops.enabled=true') to bypass the host TCP/IP stack for local intra-node pod communications.
- Engineers MUST enforce transparent encryption (WireGuard or IPsec) across cluster nodes via Cilium configuration ('encryption.enabled=true', 'encryption.type=wireguard').
- Engineers MUST enforce mutual authentication using Cilium Mutual Authentication with SPIRE/SPIFFE ('authentication.mutual.spire.enabled=true') for zero-trust cryptographic workload identity verification.
- Services requiring L7 inspection (HTTP/gRPC/Kafka) MUST declare granular CiliumNetworkPolicies routing through node-local Envoy instances on-demand, rather than deploying dedicated per-pod Envoy containers.
- Deployments MUST NOT declare duplicate TLS termination logic in application containers when transparent mTLS and Cilium mutual authentication are active.

## Bad vs Good Implementations
### Anti-Pattern: Legacy Per-Pod Envoy Sidecar Injection with Unencrypted Host Networking

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Injecting individual Envoy sidecar containers introduces 200m+ CPU and 256Mi+ memory overhead per pod, doubles context switching and kernel network traversals, and bypasses eBPF sockops fast-path interception.
```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: payment-service
  namespace: payments
spec:
  replicas: 3
  selector:
    matchLabels:
      app: payment
  template:
    metadata:
      labels:
        app: payment
      annotations:
        # ANTI-PATTERN: Forcing heavy per-pod sidecar proxy with huge CPU/RAM footprint
        sidecar.istio.io/inject: "true"
        proxy.istio.io/config: "{ 'holdApplicationUntilProxyStarts': true }"
    spec:
      containers:
        - name: payment
          image: payment-service:v2.1.0
          resources:
            limits:
              cpu: "500m"
              memory: "512Mi"
        # ANTI-PATTERN: Manual sidecar container consuming dedicated resources and adding network hops
        - name: istio-proxy
          image: docker.io/istio/proxyv2:1.20.0
          resources:
            limits:
              cpu: "200m"
              memory: "256Mi"
```

#### Production Standard (Correct)
> **Standard**: Removes proxy sidecars completely. Workload identity is attested via SPIFFE/SPIRE at the Cilium eBPF layer. Socket-level acceleration shortcuts the TCP/IP stack, and node-local Envoy only inspects L7 paths on demand.
```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: payment-service
  namespace: payments
spec:
  replicas: 3
  selector:
    matchLabels:
      app: payment
  template:
    metadata:
      labels:
        app: payment
        # Ambient mesh identity label for SPIRE/SPIFFE attestation
        spiffe.io/workload: payment-service
      annotations:
        # Ensure traditional sidecar injection is disabled
        sidecar.istio.io/inject: "false"
    spec:
      containers:
        - name: payment
          image: payment-service:v2.1.0
          resources:
            limits:
              cpu: "500m"
              memory: "512Mi"
---
apiVersion: "cilium.io/v2"
kind: CiliumNetworkPolicy
metadata:
  name: secure-payment-ingress
  namespace: payments
spec:
  endpointSelector:
    matchLabels:
      app: payment
  ingress:
    - fromEndpoints:
        - matchLabels:
            app: frontend
      # Enforces continuous cryptographic attestation via SPIRE/SPIFFE
      authentication:
        mode: "spire"
      toPorts:
        - ports:
            - port: "8443"
              protocol: TCP
          rules:
            http:
              - method: "POST"
                path: "/v1/charge"
```

Architectural Specification & Invariant Rationale

Architectural Invariant Design: Cilium eBPF Ambient Mesh Socket-Level L4/L7 Mutual TLS Interception Standard

Cilium eBPF Ambient Mesh Socket-Level L4/L7 Mutual TLS Interception Standard defines an industrial-grade behavioral standard for devops engineering. Enforces sidecar-free ambient service mesh architecture utilizing Cilium eBPF socket-layer redirection (sockops/sk_msg) and transparent kernel encryption. Eliminates sidecar memory footprint and latency penalties while guaranteeing continuous cryptographic workload attestation via SPIRE/SPIFFE and automated L4/L7 mutual TLS interception. 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: Injecting User-Space Proxy Sidecars and Bypassing Socket-Level eBPF Acceleration 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 DriftInjecting User-Space Proxy Sidecars and Bypassing Socket-Level eBPF AccelerationCritical
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 disable traditional sidecar injection annotations (e.g., sidecar.istio.io/inject

Engineers MUST ALWAYS disable traditional sidecar injection annotations (e.g., sidecar.istio.io/inject: 'false' or omitting linkerd/consul sidecars) and rely strictly on Cilium's node-level eBPF ambient mesh.

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 configure Cilium with socket-level load balancing and sockops enabled ('sockops.enabled=true') to bypass the host TCP/IP stack for local intra-node pod communications.

Engineers MUST configure Cilium with socket-level load balancing and sockops enabled ('sockops.enabled=true') to bypass the host TCP/IP stack for local intra-node pod communications.

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

Engineers MUST enforce transparent encryption (WireGuard or IPsec) across cluster nodes via Cilium configuration ('encryption.enabled=true', 'encryption.type=wireguard').

Engineers MUST enforce transparent encryption (WireGuard or IPsec) across cluster nodes via Cilium configuration ('encryption.enabled=true', 'encryption.type=wireguard').

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

Engineers MUST enforce mutual authentication using Cilium Mutual Authentication with SPIRE/SPIFFE ('authentication.mutual.spire.enabled=true') for zero-trust cryptographic workload identity verification.

Engineers MUST enforce mutual authentication using Cilium Mutual Authentication with SPIRE/SPIFFE ('authentication.mutual.spire.enabled=true') for zero-trust cryptographic workload identity verification.

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

Services requiring L7 inspection (HTTP/gRPC/Kafka) MUST declare granular CiliumNetworkPolicies routing through node-local Envoy instances on-demand, rather than deploying dedicated per-pod Envoy containers.

Services requiring L7 inspection (HTTP/gRPC/Kafka) MUST declare granular CiliumNetworkPolicies routing through node-local Envoy instances on-demand, rather than deploying dedicated per-pod Envoy 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.
6

Deployments MUST NOT declare duplicate TLS termination logic in application containers when transparent mTLS and Cilium mutual authentication are active.

Deployments MUST NOT declare duplicate TLS termination logic in application containers when transparent mTLS and Cilium mutual authentication are active.

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 Cilium eBPF Ambient Mesh Socket-Level L4/L7 Mutual TLS Interception Standard critical for AI coding assistants?

Enforces sidecar-free ambient service mesh architecture utilizing Cilium eBPF socket-layer redirection (sockops/sk_msg) and transparent kernel encryption. Eliminates sidecar memory footprint and latency penalties while guaranteeing continuous cryptographic workload attestation via SPIRE/SPIFFE and automated L4/L7 mutual TLS interception. 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 (Injecting User-Space Proxy Sidecars and Bypassing Socket-Level eBPF Acceleration) 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

Cilium