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

Cilium eBPF Sidecarless mTLS & L7 Socket Ingress Standard

Enforces kernel-level mutual authentication and L7 protocol authorization at line rate via Cilium eBPF and SPIFFE/SPIRE without user-space sidecar proxies. Guarantees that socket-level traffic redirection (sockops) adheres to strict cryptographic workload identity validation before granting ingress to application sockets.

Prohibited Anti-Pattern: Deploying Heavyweight User-Space Sidecars or Plaintext Pod Ingress Without eBPF Cryptographic Identity Enforcement

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Cilium eBPF Sidecarless mTLS & L7 Socket Ingress Standard - Enforces kernel-level mutual authentication and L7 protocol authorization at line rate via Cilium eBPF and SPIFFE/SPIRE without user-space sidecar proxies. Guarantees that socket-level traffic redirection (sockops) adheres to strict cryptographic workload identity validation before granting ingress to application sockets.
globs: deploy/**/*.yaml, deploy/**/*.yml, charts/**/*.yaml, charts/**/*.yml, k8s/**/*.yaml, k8s/**/*.yml, infra/**/*.yaml, infra/**/*.yml
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/cilium-ebpf-sidecarless-mtls-l7-ingress-production-standard"
---

# Cilium eBPF Sidecarless mTLS & L7 Socket Ingress Standard

> **Severity**: CRITICAL | **Category**: devops
> **Anti-Pattern Warning**: Deploying Heavyweight User-Space Sidecars or Plaintext Pod Ingress Without eBPF Cryptographic Identity Enforcement

## System Constraints
You are a Principal Software Architect enforcing the Cilium eBPF Sidecarless mTLS & L7 Socket Ingress Standard. Mandate that all service-to-service communication is verified at the Linux kernel layer using CiliumNetworkPolicy with native cryptographic mutual authentication (SPIFFE/SPIRE) and granular L7 rule specifications. Strictly reject standard Kubernetes NetworkPolicies that lack cryptographic identity enforcement, and eliminate user-space sidecar injection patterns that introduce memory, latency, and operational overhead.

## Strict Guidelines
- Engineers MUST ALWAYS define network authorization using CiliumNetworkPolicy (cilium.io/v2) with explicit `authentication.mode: "required"` for inter-service communication.
- Engineers MUST NOT deploy traditional user-space proxy sidecars (e.g., Istio Envoy sidecars or Linkerd proxy containers) when Cilium eBPF mesh infrastructure is present.
- Policies MUST define strict L7 HTTP/gRPC ingress rule-matching (method, path, headers) alongside socket-level CIDR/endpoint matching to prevent lateral movement.
- Services MUST attest identities through SPIFFE/SPIRE cryptographic workload identities bound natively to Cilium node agents via SPIRE agent socket mounts.
- Components NEVER accept fallback to unencrypted plaintext transport; ingress endpoints must fail-closed if node-to-node WireGuard/IPsec or eBPF mutual TLS handshakes fail.

## Bad vs Good Implementations
### CiliumNetworkPolicy Sidecarless Ingress with mTLS and L7 Enforcement

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Standard Kubernetes NetworkPolicy only validates IP/CIDR/L4 parameters and provides zero cryptographic peer identity attestation, no L7 payload inspection (HTTP paths/verbs), and leaves transport layer unauthenticated and vulnerable to IP spoofing.
```yaml
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: order-service-ingress
  namespace: production
spec:
  podSelector:
    matchLabels:
      app.kubernetes.io/name: order-service
  ingress:
    - from:
        - podSelector:
            matchLabels:
              app.kubernetes.io/name: checkout-frontend
      ports:
        - protocol: TCP
          port: 8080
  policyTypes:
    - Ingress
```

#### Production Standard (Correct)
> **Standard**: CiliumNetworkPolicy enforces cryptographic mutual authentication at the eBPF layer (SPIFFE identity verification) before socket dispatch and confines ingress access strictly to authorized HTTP endpoints and methods without injecting user-space sidecars.
```yaml
apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
  name: order-service-ingress
  namespace: production
spec:
  endpointSelector:
    matchLabels:
      app.kubernetes.io/name: order-service
  ingress:
    - fromEndpoints:
        - matchLabels:
            app.kubernetes.io/name: checkout-frontend
      authentication:
        mode: required
      toPorts:
        - ports:
            - port: "8080"
              protocol: TCP
          rules:
            http:
              - method: POST
                path: "^/v1/orders$"
              - method: GET
                path: "^/v1/orders/[a-zA-Z0-9_-]+$"
```

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 mTLS & L7 Socket Ingress Standard

Cilium eBPF Sidecarless mTLS & L7 Socket Ingress Standard defines an industrial-grade behavioral standard for devops engineering. Enforces kernel-level mutual authentication and L7 protocol authorization at line rate via Cilium eBPF and SPIFFE/SPIRE without user-space sidecar proxies. Guarantees that socket-level traffic redirection (sockops) adheres to strict cryptographic workload identity validation before granting ingress to application sockets. 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: Deploying Heavyweight User-Space Sidecars or Plaintext Pod Ingress Without eBPF Cryptographic Identity Enforcement 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 DriftDeploying Heavyweight User-Space Sidecars or Plaintext Pod Ingress Without eBPF Cryptographic Identity EnforcementCritical
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 define network authorization using CiliumNetworkPolicy (cilium.io/v2) with explicit `authentication.mode

Engineers MUST ALWAYS define network authorization using CiliumNetworkPolicy (cilium.io/v2) with explicit `authentication.mode: "required"` for inter-service communication.

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 deploy traditional user-space proxy sidecars (e.g., Istio Envoy sidecars or Linkerd proxy containers) when Cilium eBPF mesh infrastructure is present.

Engineers MUST NOT deploy traditional user-space proxy sidecars (e.g., Istio Envoy sidecars or Linkerd proxy containers) when Cilium eBPF mesh infrastructure is present.

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

Policies MUST define strict L7 HTTP/gRPC ingress rule-matching (method, path, headers) alongside socket-level CIDR/endpoint matching to prevent lateral movement.

Policies MUST define strict L7 HTTP/gRPC ingress rule-matching (method, path, headers) alongside socket-level CIDR/endpoint matching to prevent lateral movement.

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 attest identities through SPIFFE/SPIRE cryptographic workload identities bound natively to Cilium node agents via SPIRE agent socket mounts.

Services MUST attest identities through SPIFFE/SPIRE cryptographic workload identities bound natively to Cilium node agents via SPIRE agent socket mounts.

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

Components NEVER accept fallback to unencrypted plaintext transport

Components NEVER accept fallback to unencrypted plaintext transport; ingress endpoints must fail-closed if node-to-node WireGuard/IPsec or eBPF mutual TLS handshakes fail.

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 mTLS & L7 Socket Ingress Standard critical for AI coding assistants?

Enforces kernel-level mutual authentication and L7 protocol authorization at line rate via Cilium eBPF and SPIFFE/SPIRE without user-space sidecar proxies. Guarantees that socket-level traffic redirection (sockops) adheres to strict cryptographic workload identity validation before granting ingress to application sockets. 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 (Deploying Heavyweight User-Space Sidecars or Plaintext Pod Ingress Without eBPF Cryptographic Identity Enforcement) 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