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

Cilium eBPF Host-Routing Node-to-Node WireGuard Encryption Standard

Enforces transparent, kernel-level node-to-node WireGuard encryption paired with Cilium eBPF host-routing across Kubernetes clusters. Eliminates userspace context switching and MTU misconfiguration while maintaining full L7 visibility and zero-overhead packet encapsulation.

Prohibited Anti-Pattern: Deploying unencrypted pod networking or userspace mTLS sidecars alongside conflicting MTU and IPsec/WireGuard overlay settings

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Cilium eBPF Host-Routing Node-to-Node WireGuard Encryption Standard - Enforces transparent, kernel-level node-to-node WireGuard encryption paired with Cilium eBPF host-routing across Kubernetes clusters. Eliminates userspace context switching and MTU misconfiguration while maintaining full L7 visibility and zero-overhead packet encapsulation.
globs: helm/**/*.{yaml,yml}, deployments/**/*.{yaml,yml}, infrastructure/**/*.{yaml,yml,tf}, terraform/**/*.{tf,tfvars}, k8s/**/*.{yaml,yml}
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/cilium-ebpf-host-routing-wireguard-standard"
---

# Cilium eBPF Host-Routing Node-to-Node WireGuard Encryption Standard

> **Severity**: CRITICAL | **Category**: devops
> **Anti-Pattern Warning**: Deploying unencrypted pod networking or userspace mTLS sidecars alongside conflicting MTU and IPsec/WireGuard overlay settings

## System Constraints
You are a Principal DevOps and Linux Kernel Networking Architect enforcing the Cilium eBPF Host-Routing Node-to-Node WireGuard Encryption Standard. You must mandate kernel-level WireGuard encryption, native eBPF host-routing (`bpf.masquerade=true`, `tunnel=disabled` / direct routing), deterministic MTU clamping, and the complete elimination of userspace proxy encapsulation for node-to-node transit. Reject configurations attempting to mix IPsec and WireGuard, unmanaged tunnel encapsulations with host-routing, or fallback to iptables masquerading.

## Strict Guidelines
- Engineers MUST ALWAYS enable WireGuard node-to-node encryption via `encryption.type=wireguard` and `encryption.enabled=true` in Cilium Helm values.
- Engineers MUST ALWAYS enable eBPF host routing (`bpf.hostRouting=true`) and eBPF masquerading (`bpf.masquerade=true`) to bypass Linux network stack overhead and eliminate iptables packet processing.
- Engineers MUST configure direct routing mode (`routingMode=native` or `tunnel=disabled`) when pairing WireGuard with eBPF host routing, ensuring underlying subnets support direct node pod routing.
- Engineers MUST explicitly set Cilium MTU accounting for the 60-byte WireGuard encapsulation header (IPv4 WireGuard overhead: 32 bytes WireGuard + 20 bytes IPv4 + 8 bytes UDP = 60 bytes; IPv6 overhead = 80 bytes).
- Engineers MUST NEVER enable IPsec (`encryption.type=ipsec`) and WireGuard concurrently within the same Cilium deployment.
- Services MUST NOT rely on userspace sidecar proxies (e.g., Istio mTLS sidecars) solely for node-to-node network transport security when Cilium WireGuard is active.
- Components NEVER expose unencrypted node-to-node host endpoints; `encryption.nodeEncryption=true` MUST be set if host-network pod traffic requires encryption.

## Bad vs Good Implementations
### Cilium Helm Configuration: Insecure Overlay vs. Kernel eBPF WireGuard Direct Routing

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Disables packet encryption across node boundaries, falls back to legacy iptables masquerading, relies on double VXLAN encapsulation, and introduces context-switching latency by turning off eBPF host routing.
```yaml
# Inefficient userspace/vxlan configuration without WireGuard
routingMode: tunnel
tunnelProtocol: vxlan
enforceMTU: false
enableIPv4Masquerade: true
iptablesLockTimeout: 5s

# Missing WireGuard encryption and eBPF host-routing
encryption:
  enabled: false

bpf:
  hostRouting: false
  masquerade: false
```

#### Production Standard (Correct)
> **Standard**: Enables native host routing with eBPF bypassing iptables, enforces kernel-level WireGuard encryption for pod and host network traffic, properly accounts for the 60-byte MTU overhead, and enables full kube-proxy replacement.
```yaml
# Production-grade Cilium eBPF Host-Routing with WireGuard
routingMode: native
ipv4NativeRoutingCIDR: "10.244.0.0/16"
autoDirectNodeRoutes: true

# Explicit MTU calculated: Underlying MTU 1500 - 60 (WireGuard IPv4 overhead) = 1440
mtu: 1440

enryption:
  enabled: true
  type: wireguard
  nodeEncryption: true

bpf:
  hostRouting: true
  masquerade: true
  tproxy: true

kubeProxyReplacement: "true"
kubeProxyReplacementHealthzBindAddr: "0.0.0.0:10256"
```

### Terraform / Cilium Helm Release Configuration with WireGuard

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Deploys Cilium without transport-layer encryption, sending node-to-node tenant traffic across network segments in plain text.
```terraform
resource "helm_release" "cilium" {
  name       = "cilium"
  repository = "https://helm.cilium.io/"
  chart      = "cilium"
  version    = "1.15.4"

  set {
    name  = "encryption.enabled"
    value = "false"
  }
}
```

#### Production Standard (Correct)
> **Standard**: Declaratively configures Cilium Helm release using deterministic HCL with full WireGuard encryption, calculated MTU offsets, native routing, and eBPF host routing.
```terraform
resource "helm_release" "cilium" {
  name       = "cilium"
  repository = "https://helm.cilium.io/"
  chart      = "cilium"
  version    = "1.15.4"
  namespace  = "kube-system"

  values = [
    yamlencode({
      routingMode           = "native"
      ipv4NativeRoutingCIDR = var.pod_cidr
      autoDirectNodeRoutes  = true
      mtu                   = var.network_mtu - 60
      encryption = {
        enabled        = true
        type           = "wireguard"
        nodeEncryption = true
      }
      bpf = {
        hostRouting = true
        masquerade  = true
      }
      kubeProxyReplacement = "true"
    })
  ]
}
```

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 Host-Routing Node-to-Node WireGuard Encryption Standard

Cilium eBPF Host-Routing Node-to-Node WireGuard Encryption Standard defines an industrial-grade behavioral standard for devops engineering. Enforces transparent, kernel-level node-to-node WireGuard encryption paired with Cilium eBPF host-routing across Kubernetes clusters. Eliminates userspace context switching and MTU misconfiguration while maintaining full L7 visibility and zero-overhead packet encapsulation. 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 unencrypted pod networking or userspace mTLS sidecars alongside conflicting MTU and IPsec/WireGuard overlay settings 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 unencrypted pod networking or userspace mTLS sidecars alongside conflicting MTU and IPsec/WireGuard overlay settingsCritical
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 WireGuard node-to-node encryption via `encryption.type=wireguard` and `encryption.enabled=true` in Cilium Helm values.

Engineers MUST ALWAYS enable WireGuard node-to-node encryption via `encryption.type=wireguard` and `encryption.enabled=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 enable eBPF host routing (`bpf.hostRouting=true`) and eBPF masquerading (`bpf.masquerade=true`) to bypass Linux network stack overhead and eliminate iptables packet processing.

Engineers MUST ALWAYS enable eBPF host routing (`bpf.hostRouting=true`) and eBPF masquerading (`bpf.masquerade=true`) to bypass Linux network stack overhead and eliminate iptables packet processing.

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 configure direct routing mode (`routingMode=native` or `tunnel=disabled`) when pairing WireGuard with eBPF host routing, ensuring underlying subnets support direct node pod routing.

Engineers MUST configure direct routing mode (`routingMode=native` or `tunnel=disabled`) when pairing WireGuard with eBPF host routing, ensuring underlying subnets support direct node pod routing.

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 explicitly set Cilium MTU accounting for the 60-byte WireGuard encapsulation header (IPv4 WireGuard overhead

Engineers MUST explicitly set Cilium MTU accounting for the 60-byte WireGuard encapsulation header (IPv4 WireGuard overhead: 32 bytes WireGuard + 20 bytes IPv4 + 8 bytes UDP = 60 bytes; IPv6 overhead = 80 bytes).

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 NEVER enable IPsec (`encryption.type=ipsec`) and WireGuard concurrently within the same Cilium deployment.

Engineers MUST NEVER enable IPsec (`encryption.type=ipsec`) and WireGuard concurrently within the same Cilium deployment.

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 NOT rely on userspace sidecar proxies (e.g., Istio mTLS sidecars) solely for node-to-node network transport security when Cilium WireGuard is active.

Services MUST NOT rely on userspace sidecar proxies (e.g., Istio mTLS sidecars) solely for node-to-node network transport security when Cilium WireGuard 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.
7

Components NEVER expose unencrypted node-to-node host endpoints

Components NEVER expose unencrypted node-to-node host endpoints; `encryption.nodeEncryption=true` MUST be set if host-network pod traffic requires encryption.

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

Enforces transparent, kernel-level node-to-node WireGuard encryption paired with Cilium eBPF host-routing across Kubernetes clusters. Eliminates userspace context switching and MTU misconfiguration while maintaining full L7 visibility and zero-overhead packet encapsulation. 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 unencrypted pod networking or userspace mTLS sidecars alongside conflicting MTU and IPsec/WireGuard overlay settings) 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