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

Cilium eBPF Sidecarless Ambient mTLS with SPIFFE Identity Attestation Standard

Enforces sidecarless mutual TLS termination and continuous cryptographic identity validation directly within the Linux kernel via Cilium eBPF and SPIRE. Eliminates Envoy sidecar memory and CPU tax while preventing unauthenticated east-west workload impersonation. Mandates strict SPIFFE ID matching in CiliumNetworkPolicies to guarantee zero-trust kernel-level isolation.

Prohibited Anti-Pattern: Injecting User-Space Envoy Sidecars and Relying on Perimeter or Pod IP-Based Authorization

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Cilium eBPF Sidecarless Ambient mTLS with SPIFFE Identity Attestation Standard - Enforces sidecarless mutual TLS termination and continuous cryptographic identity validation directly within the Linux kernel via Cilium eBPF and SPIRE. Eliminates Envoy sidecar memory and CPU tax while preventing unauthenticated east-west workload impersonation. Mandates strict SPIFFE ID matching in CiliumNetworkPolicies to guarantee zero-trust kernel-level isolation.
globs: k8s/**/*.yaml, deploy/**/*.yaml, helm/**/*.yaml, infra/**/*.yaml, cilium/**/*.yaml
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/cilium-ebpf-ambient-mtls-spiffe-production-standard"
---

# Cilium eBPF Sidecarless Ambient mTLS with SPIFFE Identity Attestation Standard

> **Severity**: CRITICAL | **Category**: devops
> **Anti-Pattern Warning**: Injecting User-Space Envoy Sidecars and Relying on Perimeter or Pod IP-Based Authorization

## System Constraints
You are a Principal Infrastructure Architect enforcing sidecarless zero-trust networking using Cilium eBPF and SPIFFE/SPIRE. You strictly eliminate user-space sidecar proxies, mandate kernel-enforced mTLS via Cilium Node Agents, and ensure all east-west ingress/egress policies validate cryptographic SPIFFE identity vectors rather than mutable Kubernetes pod IP addresses.

## Strict Guidelines
- Engineers MUST ALWAYS set 'sidecar.istio.io/inject: false' or remove sidecar injection annotations entirely, shifting transport encryption to Cilium eBPF.
- Engineers MUST configure Cilium to integrate with SPIRE using Unix Domain Sockets for workload attestation and X.509 SVID issuance.
- CiliumNetworkPolicy manifests MUST explicitly require 'authentication.mode: spiffe' on all ingress and egress zero-trust rule blocks.
- Services MUST identify peer workloads via fully qualified SPIFFE IDs (e.g., 'spiffe://cluster.local/ns/{namespace}/sa/{serviceaccount}') instead of pod labels or IP-based CIDR blocks.
- Engineers MUST NOT allow unauthenticated cleartext fallback; strict mutual TLS enforcement mode must be set to drop non-attested eBPF socket connections.
- Cilium eBPF programs MUST bypass user-space Envoy proxies for transport-only L4 security, delegating purely to kernel sockops and TC programs for maximum throughput.

## Bad vs Good Implementations
### CiliumNetworkPolicy Enforcing SPIFFE Identity Attestation without Sidecars

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Injecting user-space sidecars imposes significant CPU/RAM overhead and context switching. Granting network access purely based on mutable Kubernetes labels without cryptographic SPIFFE identity attestation fails zero-trust criteria and exposes the cluster to label spoofing and compromised pod impersonation.
```yaml
# Anti-Pattern: User-space sidecar injection and IP-based podSelector without cryptographic attestation
apiVersion: apps/v1
kind: Deployment
metadata:
  name: billing-service
  namespace: payments
spec:
  template:
    metadata:
      annotations:
        sidecar.istio.io/inject: "true" # Costly user-space Envoy sidecar proxy
    spec:
      containers:
        - name: billing
          image: billing:v2.1.0
---
apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
  name: allow-checkout-ingress
  namespace: payments
spec:
  endpointSelector:
    matchLabels:
      app: billing-service
  ingress:
    - fromEndpoints:
        - matchLabels:
            app: checkout-service # Vulnerable: Labels can be spoofed; lacks mTLS/SPIFFE proof
```

#### Production Standard (Correct)
> **Standard**: Disables user-space sidecars and invokes Cilium's native eBPF ambient security layer. The policy enforces 'authentication.mode: spiffe', ensuring Cilium's eBPF programs verify the peer's SPIFFE SVID issued by SPIRE before passing network packets to the billing application socket.
```yaml
# Production Invariant: Ambient sidecarless deployment with SPIFFE-attested Cilium eBPF mTLS
apiVersion: apps/v1
kind: Deployment
metadata:
  name: billing-service
  namespace: payments
spec:
  template:
    metadata:
      labels:
        app: billing-service
      annotations:
        sidecar.istio.io/inject: "false" # Sidecarless: Handled natively in-kernel
    spec:
      serviceAccountName: billing-sa
      containers:
        - name: billing
          image: billing:v2.1.0
---
apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
  name: allow-checkout-ingress-spiffe
  namespace: payments
spec:
  endpointSelector:
    matchLabels:
      app: billing-service
  ingress:
    - fromEndpoints:
        - matchLabels:
            app: checkout-service
      authentication:
        mode: "spiffe"
      toPorts:
        - ports:
            - port: "8443"
              protocol: TCP
          rules:
            http:
              - method: "POST"
                path: "/v1/charge"
  ingressDeny:
    - fromEntities:
        - unmanaged
        - world
```

Recommended MCP Servers (mcp-serverlist.com)

Equip agent with system tools to verify code for this stack.

Recommended Agent Skills (askills.dev)

Ready-to-use executable skill functions tailored to this stack.

Architectural Specification & Invariant Rationale

Architectural Invariant Design: Cilium eBPF Sidecarless Ambient mTLS with SPIFFE Identity Attestation Standard

Cilium eBPF Sidecarless Ambient mTLS with SPIFFE Identity Attestation Standard defines an industrial-grade behavioral standard for devops engineering. Enforces sidecarless mutual TLS termination and continuous cryptographic identity validation directly within the Linux kernel via Cilium eBPF and SPIRE. Eliminates Envoy sidecar memory and CPU tax while preventing unauthenticated east-west workload impersonation. Mandates strict SPIFFE ID matching in CiliumNetworkPolicies to guarantee zero-trust kernel-level isolation. 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 Envoy Sidecars and Relying on Perimeter or Pod IP-Based Authorization 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 Envoy Sidecars and Relying on Perimeter or Pod IP-Based AuthorizationCritical
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 set 'sidecar.istio.io/inject

Engineers MUST ALWAYS set 'sidecar.istio.io/inject: false' or remove sidecar injection annotations entirely, shifting transport encryption to Cilium eBPF.

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 to integrate with SPIRE using Unix Domain Sockets for workload attestation and X.509 SVID issuance.

Engineers MUST configure Cilium to integrate with SPIRE using Unix Domain Sockets for workload attestation and X.509 SVID issuance.

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

CiliumNetworkPolicy manifests MUST explicitly require 'authentication.mode

CiliumNetworkPolicy manifests MUST explicitly require 'authentication.mode: spiffe' on all ingress and egress zero-trust rule blocks.

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

Services MUST identify peer workloads via fully qualified SPIFFE IDs (e.g., 'spiffe

Services MUST identify peer workloads via fully qualified SPIFFE IDs (e.g., 'spiffe://cluster.local/ns/{namespace}/sa/{serviceaccount}') instead of pod labels or IP-based CIDR blocks.

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

Engineers MUST NOT allow unauthenticated cleartext fallback

Engineers MUST NOT allow unauthenticated cleartext fallback; strict mutual TLS enforcement mode must be set to drop non-attested eBPF socket connections.

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

Cilium eBPF programs MUST bypass user-space Envoy proxies for transport-only L4 security, delegating purely to kernel sockops and TC programs for maximum throughput.

Cilium eBPF programs MUST bypass user-space Envoy proxies for transport-only L4 security, delegating purely to kernel sockops and TC programs for maximum throughput.

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 Sidecarless Ambient mTLS with SPIFFE Identity Attestation Standard critical for AI coding assistants?

Enforces sidecarless mutual TLS termination and continuous cryptographic identity validation directly within the Linux kernel via Cilium eBPF and SPIRE. Eliminates Envoy sidecar memory and CPU tax while preventing unauthenticated east-west workload impersonation. Mandates strict SPIFFE ID matching in CiliumNetworkPolicies to guarantee zero-trust kernel-level isolation. 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 Envoy Sidecars and Relying on Perimeter or Pod IP-Based Authorization) 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