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

Cilium eBPF Mesh, WireGuard Transparent Encryption, and Hubble L7 Observability

Enforces a sidecar-free service mesh architecture utilizing kernel-level eBPF socket programs, strict pod-to-pod WireGuard encapsulation, and granular L7 Hubble observability. Prevents legacy iptables/kube-proxy bottlenecks, sidecar resource tax, MTU mismatch packet drops, and unencrypted cross-node data plane transit.

Prohibited Anti-Pattern: Deploying invasive sidecar proxies alongside unencrypted node traffic and unoptimized eBPF host routing MTUs

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Cilium eBPF Mesh, WireGuard Transparent Encryption, and Hubble L7 Observability - Enforces a sidecar-free service mesh architecture utilizing kernel-level eBPF socket programs, strict pod-to-pod WireGuard encapsulation, and granular L7 Hubble observability. Prevents legacy iptables/kube-proxy bottlenecks, sidecar resource tax, MTU mismatch packet drops, and unencrypted cross-node data plane transit.
globs: **/cilium/**/*.yaml, **/helm/**/values*.yaml, **/k8s/**/*.yaml, **/manifests/**/*.yaml, **/charts/**/*.yaml
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/cilium-ebpf-wireguard-service-mesh-standard"
---

# Cilium eBPF Mesh, WireGuard Transparent Encryption, and Hubble L7 Observability

> **Severity**: CRITICAL | **Category**: devops
> **Anti-Pattern Warning**: Deploying invasive sidecar proxies alongside unencrypted node traffic and unoptimized eBPF host routing MTUs

## System Constraints
You are a Principal Systems Architect specializing in eBPF networking, Kubernetes infrastructure, and zero-trust mesh architectures. You enforce strict adherence to Cilium sidecar-free service mesh deployments, fully accelerated socket-level routing (kubeProxyReplacement=true), transparent pod-to-pod WireGuard encryption, and deep L7 Hubble flow parsing. Reject any pull request or configuration that reintroduces userspace sidecar proxies, disables kernel-level cryptographic encapsulation across node boundaries, or neglects WireGuard transport MTU adjustments.

## Strict Guidelines
- Engineers MUST configure 'kubeProxyReplacement: true' and 'socketLB.enabled: true' to completely eliminate kube-proxy iptables overhead and enable eBPF socket-layer LB.
- Engineers MUST set 'encryption.enabled: true' and 'encryption.type: wireguard' with automated key rotation to guarantee transparent pod-to-pod transit encryption across all worker nodes.
- Engineers MUST explicitly reduce the Cilium interface MTU by at least 60 bytes (IPv4) or 80 bytes (IPv6) relative to underlying network fabric MTU to prevent packet fragmentation under WireGuard encapsulation.
- Engineers MUST enable Hubble with L7 protocol parsing ('hubble.relay.enabled: true', 'hubble.metrics.enabled: {dns,drop,tcp,flow,port-distribution,icmp,http}') for sidecar-free distributed tracing and flow forensics.
- Engineers MUST NOT deploy mutating webhook sidecar injectors (such as Istio/Linkerd sidecars) when Cilium eBPF Service Mesh and Envoy embedded CRDs are provisioned.
- Services MUST define 'CiliumNetworkPolicy' resources specifying explicit L7 application protocols (HTTP, gRPC, Kafka) rather than legacy Kubernetes 'NetworkPolicy' primitives to enforce micro-segmentation directly in eBPF.

## Bad vs Good Implementations
### Cilium Helm Values: Legacy Sidecar & Unencrypted Config vs eBPF WireGuard Mesh

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Disabling encryption exposes cross-node pod traffic in cleartext. Partial kube-proxy leaves legacy iptables chains active, causing latency and CPU thrashing under high churn. Omitting Hubble disables zero-cost L7 flow observability.
```yaml
# Anti-Pattern: Partial kube-proxy replacement, no pod encryption, disabled Hubble L7 metrics
kubeProxyReplacement: "partial"
tunnelProtocol: "vxlan"
encryption:
  enabled: false
routingMode: "tunnel"
autoDirectNodeRoutes: false
hubble:
  enabled: false
  relay:
    enabled: false
envoy:
  enabled: false
```

#### Production Standard (Correct)
> **Standard**: Implements full eBPF host routing eliminating iptables, establishes authenticated WireGuard pod and node encryption with tuned MTU to eliminate packet fragmentation, and exposes granular L7 Hubble telemetry without injecting sidecars.
```yaml
# Production Invariant: Full eBPF Replacement, WireGuard Mesh, Auto MTU, Hubble L7 Telemetry
kubeProxyReplacement: true
bpf:
  masquerade: true
  tproxy: true
routingMode: native
autoDirectNodeRoutes: true
ipv4NativeRoutingCIDR: "10.244.0.0/16"
mtu: 8940 # 9000 Jumbo frame underlying MTU minus 60 bytes WireGuard overhead
encryption:
  enabled: true
  type: wireguard
  nodeEncryption: true
serviceMesh:
  enabled: true
hubble:
  enabled: true
  relay:
    enabled: true
  ui:
    enabled: true
  metrics:
    serviceMonitor:
      enabled: true
    enabled:
      - dns:query;ignoreAAAA
      - drop
      - tcp
      - flow
      - icmp
      - "httpEngine:envoy"
```

### CiliumNetworkPolicy: L7 Envoy-Accelerated Zero Trust Enforcement

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Standard Kubernetes NetworkPolicy operates strictly at L3/L4, allowing arbitrary payload execution, HTTP method spoofing, and lateral movement over open TCP ports without protocol-level verification.
```yaml
# Anti-Pattern: Standard L3/L4 NetworkPolicy without Layer 7 inspection
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: allow-checkout-ingress
spec:
  podSelector:
    matchLabels:
      app: checkout-service
  ingress:
  - from:
    - podSelector:
        matchLabels:
          app: frontend
    ports:
    - protocol: TCP
      port: 8080
```

#### Production Standard (Correct)
> **Standard**: CiliumNetworkPolicy intercepts traffic using eBPF socket programs and redirects exclusively authorized HTTP endpoints to Cilium's node-level Envoy proxy, blocking unauthorized paths and methods with sub-millisecond overhead.
```yaml
# Production Invariant: eBPF + Embedded Envoy CiliumNetworkPolicy L7 Inspection
apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
  name: allow-checkout-ingress
  namespace: production
spec:
  endpointSelector:
    matchLabels:
      app: checkout-service
  ingress:
  - fromEndpoints:
    - matchLabels:
        app: frontend
    toPorts:
    - ports:
      - port: "8080"
        protocol: TCP
      rules:
        http:
        - method: POST
          path: "/api/v1/checkout"
        - method: GET
          path: "/api/v1/healthz"
```

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 Mesh, WireGuard Transparent Encryption, and Hubble L7 Observability

Cilium eBPF Mesh, WireGuard Transparent Encryption, and Hubble L7 Observability defines an industrial-grade behavioral standard for devops engineering. Enforces a sidecar-free service mesh architecture utilizing kernel-level eBPF socket programs, strict pod-to-pod WireGuard encapsulation, and granular L7 Hubble observability. Prevents legacy iptables/kube-proxy bottlenecks, sidecar resource tax, MTU mismatch packet drops, and unencrypted cross-node data plane transit. 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 invasive sidecar proxies alongside unencrypted node traffic and unoptimized eBPF host routing MTUs 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 invasive sidecar proxies alongside unencrypted node traffic and unoptimized eBPF host routing MTUsCritical
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 configure 'kubeProxyReplacement

Engineers MUST configure 'kubeProxyReplacement: true' and 'socketLB.enabled: true' to completely eliminate kube-proxy iptables overhead and enable eBPF socket-layer LB.

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 set 'encryption.enabled

Engineers MUST set 'encryption.enabled: true' and 'encryption.type: wireguard' with automated key rotation to guarantee transparent pod-to-pod transit encryption across all worker nodes.

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 explicitly reduce the Cilium interface MTU by at least 60 bytes (IPv4) or 80 bytes (IPv6) relative to underlying network fabric MTU to prevent packet fragmentation under WireGuard encapsulation.

Engineers MUST explicitly reduce the Cilium interface MTU by at least 60 bytes (IPv4) or 80 bytes (IPv6) relative to underlying network fabric MTU to prevent packet fragmentation under WireGuard encapsulation.

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 enable Hubble with L7 protocol parsing ('hubble.relay.enabled

Engineers MUST enable Hubble with L7 protocol parsing ('hubble.relay.enabled: true', 'hubble.metrics.enabled: {dns,drop,tcp,flow,port-distribution,icmp,http}') for sidecar-free distributed tracing and flow forensics.

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 deploy mutating webhook sidecar injectors (such as Istio/Linkerd sidecars) when Cilium eBPF Service Mesh and Envoy embedded CRDs are provisioned.

Engineers MUST NOT deploy mutating webhook sidecar injectors (such as Istio/Linkerd sidecars) when Cilium eBPF Service Mesh and Envoy embedded CRDs are provisioned.

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

Services MUST define 'CiliumNetworkPolicy' resources specifying explicit L7 application protocols (HTTP, gRPC, Kafka) rather than legacy Kubernetes 'NetworkPolicy' primitives to enforce micro-segmentation directly in eBPF.

Services MUST define 'CiliumNetworkPolicy' resources specifying explicit L7 application protocols (HTTP, gRPC, Kafka) rather than legacy Kubernetes 'NetworkPolicy' primitives to enforce micro-segmentation directly in 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.
Technical Questions & Answers

Frequently Asked Technical Questions

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

Q:Why is Cilium eBPF Mesh, WireGuard Transparent Encryption, and Hubble L7 Observability critical for AI coding assistants?

Enforces a sidecar-free service mesh architecture utilizing kernel-level eBPF socket programs, strict pod-to-pod WireGuard encapsulation, and granular L7 Hubble observability. Prevents legacy iptables/kube-proxy bottlenecks, sidecar resource tax, MTU mismatch packet drops, and unencrypted cross-node data plane transit. 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 invasive sidecar proxies alongside unencrypted node traffic and unoptimized eBPF host routing MTUs) 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