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

Cilium eBPF Host-to-Host WireGuard Mesh Encryption Standard

Enforces zero-overhead, in-kernel WireGuard transport encryption across Kubernetes pod-to-pod and host-to-host fabrics using Cilium eBPF. Eliminates userspace proxy sidecar memory and latency penalties while ensuring full network fabric privacy without packet fragmentation. Mandates strict kernel prerequisites, MTU headrooms, and complete node-to-node encryption coverage.

Prohibited Anti-Pattern: Partial Pod-Only Mesh Encryption with Unadjusted MTU and Userspace Sidecar Duplication

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Cilium eBPF Host-to-Host WireGuard Mesh Encryption Standard - Enforces zero-overhead, in-kernel WireGuard transport encryption across Kubernetes pod-to-pod and host-to-host fabrics using Cilium eBPF. Eliminates userspace proxy sidecar memory and latency penalties while ensuring full network fabric privacy without packet fragmentation. Mandates strict kernel prerequisites, MTU headrooms, and complete node-to-node encryption coverage.
globs: **/helm/**/cilium*.yaml, **/charts/**/values*.yaml, **/cilium-values*.yaml, **/k8s/**/*.yaml, **/terraform/**/*.tf
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/cilium-ebpf-wireguard-mesh-encryption-standard"
---

# Cilium eBPF Host-to-Host WireGuard Mesh Encryption Standard

> **Severity**: CRITICAL | **Category**: devops
> **Anti-Pattern Warning**: Partial Pod-Only Mesh Encryption with Unadjusted MTU and Userspace Sidecar Duplication

## System Constraints
You are a Principal Infrastructure Architect enforcing the Cilium eBPF Host-to-Host WireGuard Mesh Encryption Standard. You must reject any Kubernetes networking configuration that leaves node-to-node traffic unencrypted, misconfigures MTU headrooms for WireGuard encapsulation, or redundantly deploys userspace mTLS sidecars for transport-layer security.

## Strict Guidelines
- Engineers MUST ALWAYS enable both pod-to-pod and host-to-host encryption by setting `encryption.enabled: true`, `encryption.type: wireguard`, and `encryption.nodeEncryption: true` in Cilium Helm values.
- Engineers MUST ALWAYS account for the 60-byte WireGuard overhead (or 80-byte for IPv6) by explicitly adjusting Cilium MTU or ensuring automatic MTU detection is active and verified across all underlying NICs to prevent PMTU discovery blackholes.
- Engineers MUST NOT deploy userspace mTLS sidecar proxies (e.g., Istio Envoy, Linkerd) exclusively for transport-layer L3/L4 encryption when Cilium WireGuard eBPF mesh is active.
- Engineers MUST verify that target Kubernetes worker node kernels are >= 5.6 or have the out-of-tree WireGuard module loaded prior to deploying the encryption standard.
- Services MUST route traffic through native eBPF host routing (`bpf.masquerade: true`, `tunnel: disabled` or `native-routing-cidr` specified) to avoid unnecessary encapsulation loops and maintain near-native wire throughput.
- Components NEVER fall back to plaintext unencrypted inter-node communication silently; strict routing and network security policies must drop unencrypted cross-node packets.

## Bad vs Good Implementations
### Cilium Helm Configuration for WireGuard Mesh Encryption

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Omitting `nodeEncryption: true` leaves host-network pods (e.g., storage drivers, ingress controllers) and host-to-host control traffic unencrypted. Stacking WireGuard on top of VXLAN without accounting for MTU overhead causes silent packet fragmentation and connection drops.
```yaml
# INSECURE: Node traffic unencrypted, default MTU leads to packet drops, no routing optimization
cilium:
  encryption:
    enabled: true
    type: wireguard
    # Flaw 1: nodeEncryption omitted (defaults to false), leaving host-network pods and node traffic exposed
  tunnel: vxlan
  # Flaw 2: Missing MTU adjustments when running over standard 1500-byte parent NICs with VXLAN + WireGuard
  # Flaw 3: Inefficient userspace routing overhead and missing eBPF host routing
```

#### Production Standard (Correct)
> **Standard**: Explicitly enables `nodeEncryption` to encrypt both pod and node traffic. Configures native eBPF routing to bypass encapsulation overlays and clamps the MTU to 1440 to prevent fragmentation overhead across 1500-byte physical fabrics.
```yaml
# SECURE & OPTIMIZED: Full pod + host WireGuard mesh with calculated MTU and direct eBPF routing
encryption:
  enabled: true
  type: wireguard
  nodeEncryption: true

# Enforce native eBPF host routing without overlay encapsulation overhead
tunnel: "disabled"
autoDirectNodeRoutes: true
ipv4NativeRoutingCIDR: "10.244.0.0/16"

bpf:
  masquerade: true
  hostRouting: true

# Account for WireGuard encapsulation overhead: 1500 (underlay) - 60 (IPv4 WG) = 1440 MTU
mtu: 1440
```

Recommended MCP Servers (mcp-serverlist.com)

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

Architectural Specification & Invariant Rationale

Architectural Invariant Design: Cilium eBPF Host-to-Host WireGuard Mesh Encryption Standard

Cilium eBPF Host-to-Host WireGuard Mesh Encryption Standard defines an industrial-grade behavioral standard for devops engineering. Enforces zero-overhead, in-kernel WireGuard transport encryption across Kubernetes pod-to-pod and host-to-host fabrics using Cilium eBPF. Eliminates userspace proxy sidecar memory and latency penalties while ensuring full network fabric privacy without packet fragmentation. Mandates strict kernel prerequisites, MTU headrooms, and complete node-to-node encryption coverage. 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: Partial Pod-Only Mesh Encryption with Unadjusted MTU and Userspace Sidecar Duplication 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 DriftPartial Pod-Only Mesh Encryption with Unadjusted MTU and Userspace Sidecar DuplicationCritical
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 enable both pod-to-pod and host-to-host encryption by setting `encryption.enabled

Engineers MUST ALWAYS enable both pod-to-pod and host-to-host encryption by setting `encryption.enabled: true`, `encryption.type: wireguard`, and `encryption.nodeEncryption: true` in Cilium Helm values.

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 ALWAYS account for the 60-byte WireGuard overhead (or 80-byte for IPv6) by explicitly adjusting Cilium MTU or ensuring automatic MTU detection is active and verified across all underlying NICs to prevent PMTU discovery blackholes.

Engineers MUST ALWAYS account for the 60-byte WireGuard overhead (or 80-byte for IPv6) by explicitly adjusting Cilium MTU or ensuring automatic MTU detection is active and verified across all underlying NICs to prevent PMTU discovery blackholes.

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 NOT deploy userspace mTLS sidecar proxies (e.g., Istio Envoy, Linkerd) exclusively for transport-layer L3/L4 encryption when Cilium WireGuard eBPF mesh is active.

Engineers MUST NOT deploy userspace mTLS sidecar proxies (e.g., Istio Envoy, Linkerd) exclusively for transport-layer L3/L4 encryption when Cilium WireGuard eBPF mesh is 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.
4

Engineers MUST verify that target Kubernetes worker node kernels are >= 5.6 or have the out-of-tree WireGuard module loaded prior to deploying the encryption standard.

Engineers MUST verify that target Kubernetes worker node kernels are >= 5.6 or have the out-of-tree WireGuard module loaded prior to deploying the encryption standard.

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 MUST route traffic through native eBPF host routing (`bpf.masquerade

Services MUST route traffic through native eBPF host routing (`bpf.masquerade: true`, `tunnel: disabled` or `native-routing-cidr` specified) to avoid unnecessary encapsulation loops and maintain near-native wire 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.
6

Components NEVER fall back to plaintext unencrypted inter-node communication silently

Components NEVER fall back to plaintext unencrypted inter-node communication silently; strict routing and network security policies must drop unencrypted cross-node packets.

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 Host-to-Host WireGuard Mesh Encryption Standard critical for AI coding assistants?

Enforces zero-overhead, in-kernel WireGuard transport encryption across Kubernetes pod-to-pod and host-to-host fabrics using Cilium eBPF. Eliminates userspace proxy sidecar memory and latency penalties while ensuring full network fabric privacy without packet fragmentation. Mandates strict kernel prerequisites, MTU headrooms, and complete node-to-node encryption coverage. 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 (Partial Pod-Only Mesh Encryption with Unadjusted MTU and Userspace Sidecar Duplication) 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