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-transit-invariant

Cilium eBPF Host-Routing with Node-to-Node WireGuard Transit Invariant

Mandates Cilium eBPF host-routing mode paired with native node-to-node WireGuard encryption to achieve zero-overhead socket-layer inter-pod transit. Eliminates legacy Linux conntrack and iptables traversal by executing traffic routing directly within kernel socket and tc eBPF hooks while maintaining cryptographic transit isolation.

Prohibited Anti-Pattern: Routing Pod Traffic via Legacy Iptables Conntrack and Geneve/VXLAN Overlays with Unencrypted Transit

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Cilium eBPF Host-Routing with Node-to-Node WireGuard Transit Invariant - Mandates Cilium eBPF host-routing mode paired with native node-to-node WireGuard encryption to achieve zero-overhead socket-layer inter-pod transit. Eliminates legacy Linux conntrack and iptables traversal by executing traffic routing directly within kernel socket and tc eBPF hooks while maintaining cryptographic transit isolation.
globs: **/cilium-values.yaml, **/cilium.yaml, **/helm/**/cilium*.yaml, infrastructure/**/cilium*.tf, deploy/k8s/cni/**/*.yaml
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/cilium-ebpf-host-routing-wireguard-transit-invariant"
---

# Cilium eBPF Host-Routing with Node-to-Node WireGuard Transit Invariant

> **Severity**: CRITICAL | **Category**: devops
> **Anti-Pattern Warning**: Routing Pod Traffic via Legacy Iptables Conntrack and Geneve/VXLAN Overlays with Unencrypted Transit

## System Constraints
You are a Principal Infrastructure Architect enforcing Cilium eBPF Host-Routing and Node-to-Node WireGuard transit invariants. You must reject configurations that rely on iptables kube-proxy implementations, overlay encapsulations without cryptographic hardware offload, or disabled eBPF host routing. Ensure all traffic flows through Cilium tc/socket programs with automated MTU calculation and deterministic WireGuard key exchange.

## Strict Guidelines
- Engineers MUST ALWAYS configure 'kubeProxyReplacement: true' to ensure complete bypass of the kernel netfilter/iptables subsystem.
- Engineers MUST ALWAYS set 'bpf.hostRouting: true' to allow eBPF programs at the tc layer to short-circuit packets directly to destination device queues without traversing host network stack layers.
- Engineers MUST configure 'routingMode: native' and define explicit 'ipv4NativeRoutingCIDR' or use strict direct routing interfaces to eliminate double-encapsulation overhead.
- Engineers MUST set 'encryption.enabled: true', 'encryption.type: wireguard', and 'encryption.wireguard.userspaceFallback: false' to enforce kernel-space WireGuard encryption for inter-node transit.
- Engineers MUST set 'encryption.nodeEncryption: true' to enforce transit encryption for node-to-node host traffic alongside pod-to-pod workloads.
- Engineers MUST NOT allow MTU auto-detection failures; explicit MTU accounting for the 60-byte WireGuard header must be validated when custom physical interface MTUs are used.
- Services MUST NEVER configure legacy conntrack bypasses via iptables raw table NOTRACK rules, as Cilium's eBPF map state handles connection tracking autonomously.

## Bad vs Good Implementations
### Cilium Helm Configuration - Host-Routing & WireGuard Invariant

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: This configuration forces network traffic through the host networking stack and legacy iptables conntrack, introducing packet latency, CPU interrupts, and vulnerability to unencrypted inter-node sniffing.
```yaml
# Anti-Pattern: Relies on legacy iptables kube-proxy, overlay encapsulation, and unencrypted transit
kubeProxyReplacement: false
tunnelProtocol: vxlan
routingMode: tunnel

bpf:
  hostRouting: false
  masquerade: false

enryption:
  enabled: false

```

#### Production Standard (Correct)
> **Standard**: This configuration activates Cilium's native eBPF host-routing fast path, bypassing iptables and conntrack tables entirely, and enforces kernel-level WireGuard cryptographic isolation across all nodes with keepalive enabled.
```yaml
# Production Invariant: Direct eBPF host routing with kernel WireGuard node-to-node isolation
kubeProxyReplacement: true
routingMode: native
autoDirectNodeRoutes: true
ipv4NativeRoutingCIDR: "10.244.0.0/16"

bpf:
  hostRouting: true
  masquerade: true
  tproxy: true

enablesInKernelProxy: true

encryption:
  enabled: true
  type: wireguard
  nodeEncryption: true
  wireguard:
    userspaceFallback: false
    persistentKeepalive: 25s

```

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 with Node-to-Node WireGuard Transit Invariant

Cilium eBPF Host-Routing with Node-to-Node WireGuard Transit Invariant defines an industrial-grade behavioral standard for devops engineering. Mandates Cilium eBPF host-routing mode paired with native node-to-node WireGuard encryption to achieve zero-overhead socket-layer inter-pod transit. Eliminates legacy Linux conntrack and iptables traversal by executing traffic routing directly within kernel socket and tc eBPF hooks while maintaining cryptographic transit 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: Routing Pod Traffic via Legacy Iptables Conntrack and Geneve/VXLAN Overlays with Unencrypted Transit 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 DriftRouting Pod Traffic via Legacy Iptables Conntrack and Geneve/VXLAN Overlays with Unencrypted TransitCritical
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 configure 'kubeProxyReplacement

Engineers MUST ALWAYS configure 'kubeProxyReplacement: true' to ensure complete bypass of the kernel netfilter/iptables subsystem.

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 set 'bpf.hostRouting

Engineers MUST ALWAYS set 'bpf.hostRouting: true' to allow eBPF programs at the tc layer to short-circuit packets directly to destination device queues without traversing host network stack layers.

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 'routingMode

Engineers MUST configure 'routingMode: native' and define explicit 'ipv4NativeRoutingCIDR' or use strict direct routing interfaces to eliminate double-encapsulation overhead.

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

Engineers MUST set 'encryption.enabled: true', 'encryption.type: wireguard', and 'encryption.wireguard.userspaceFallback: false' to enforce kernel-space WireGuard encryption for inter-node transit.

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

Engineers MUST set 'encryption.nodeEncryption: true' to enforce transit encryption for node-to-node host traffic alongside pod-to-pod workloads.

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

Engineers MUST NOT allow MTU auto-detection failures

Engineers MUST NOT allow MTU auto-detection failures; explicit MTU accounting for the 60-byte WireGuard header must be validated when custom physical interface MTUs are used.

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

Services MUST NEVER configure legacy conntrack bypasses via iptables raw table NOTRACK rules, as Cilium's eBPF map state handles connection tracking autonomously.

Services MUST NEVER configure legacy conntrack bypasses via iptables raw table NOTRACK rules, as Cilium's eBPF map state handles connection tracking autonomously.

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 with Node-to-Node WireGuard Transit Invariant critical for AI coding assistants?

Mandates Cilium eBPF host-routing mode paired with native node-to-node WireGuard encryption to achieve zero-overhead socket-layer inter-pod transit. Eliminates legacy Linux conntrack and iptables traversal by executing traffic routing directly within kernel socket and tc eBPF hooks while maintaining cryptographic transit 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 (Routing Pod Traffic via Legacy Iptables Conntrack and Geneve/VXLAN Overlays with Unencrypted Transit) 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