CILIUM · CILIUM: UP AND RUNNING · CHAPTER 14

Transparent encryption

WireGuard between nodes, without touching the applications: what it protects and how to verify it.

4 min readBook: Cilium: Up and RunningLevel: intermediate

From point A to point B

Point A: your pods talk across nodes in plain text, and anyone who can look at the physical network or the hypervisor's virtual switch can read it. Point B: by the end of this chapter you'll turn on transparent encryption with WireGuard, prove it works by capturing traffic, and know exactly what it encrypts and what it doesn't.

What it's for: compliance and threats

It's called transparent because the pods never notice: no changes to the applications, no certificates, no sidecars. Cilium can use WireGuard or IPsec; this chapter uses WireGuard, which is simpler to operate.

  • Compliance: many regulatory frameworks (healthcare, finance, the public sector) require encryption in transit. The platform team can guarantee it across the whole cluster without depending on each application team. Check with your auditors which algorithms they accept: WireGuard uses a fixed, modern set.
  • Threat model: it protects against anyone who can observe the network between nodes: a compromised switch, a shared link or a hypervisor's virtual switch. Define first who you're protecting yourself from; that decides whether this is enough.

What gets encrypted and what doesn't

What WireGuard encrypts Traffic between Cilium-managed pods on different nodes goes through the WireGuard tunnel and is encrypted. Traffic between pods on the same node, traffic from host-network processes, and traffic to destinations outside the cluster is not encrypted by default. Node-to-node encryption, in beta, extends the tunnel to host traffic. NODE 1 NODE 2 pod A pod B host process pod C cilium_wg0 same node: plain ENCRYPTEDUDP 51871 host → pod: plain to the internet: plain only pod-to-pod across nodes is encrypted by default · the pods never notice

By default, only traffic between pods on different nodes. Diagram: The House of Routing.

TrafficEncrypted?
Pod to pod, on different nodesYes
Pod to pod, on the same nodeNo: it never leaves the node
Node or hostNetwork pod to podNo, unless you use node encryption (beta)
Out of the clusterNo
Between processes in the same pod or over UNIX socketsNo: it doesn't go through the network

Why not encrypt inside the node? Because whoever can read that traffic already controls the node, and with it the pods' memory and the keys. Encrypting it wouldn't add any protection.

Encryption happens after services are resolved: a packet to a ClusterIP is only encrypted if the chosen backend is on another node.

How the packet travels

WireGuard packet layout With native routing, the pod packet is encrypted and carried inside a WireGuard UDP packet between node addresses. With VXLAN tunneling, the VXLAN packet is built first and then encrypted, so the wire shows only node IPs, UDP 51871 and an encrypted payload. NATIVE ROUTING IP node → node UDP 51871 encrypted: IP pod → pod · TCP · HTTP VXLAN TUNNELING IP node → node UDP 51871 encrypted: VXLAN · Ethernet · IP pod → pod · … an observer sees which nodes talk and how much, but not which pods or what they say

On the wire you only see the node IPs and UDP port 51871. Diagram: The House of Routing.

  • WireGuard encrypts the whole packet from the IP header on and sends it inside UDP on port 51871. Allow that port between nodes in your firewalls, and between clusters with Cluster Mesh too.
  • With VXLAN tunnels, the packet is encapsulated in VXLAN first and then encrypted.
  • An observer can still see which nodes talk, when and how much, but not which pods or what they say.
  • Encryption is done by the kernel's WireGuard (Linux 5.6 or later). Cilium distributes the keys, creates the tunnels and steers the packets.
  • Each agent generates its key pair and publishes the public key on its CiliumNode. The exchange goes through the Kubernetes API, so API server authentication is the root of trust.

Turning on and verifying WireGuard

# values-wireguard.yaml
encryption:
  enabled: true
  type: wireguard
  # nodeEncryption: true   # beta: also encrypts node-to-node and node-to-pod traffic
kind create cluster --config kind-cilium.yaml --name wg
helm install cilium cilium/cilium --version 1.20.3 -n kube-system \
  --kube-context kind-wg -f values-wireguard.yaml
cilium status --context kind-wg --wait

# cilium_wg0 interface and number of peers (nodes − 1)
kubectl --context kind-wg -n kube-system exec ds/cilium -- cilium-dbg status | grep Encryption

# Each node's public key, published on its CiliumNode
kubectl --context kind-wg get ciliumnodes \
  -o custom-columns='NODE:.metadata.name,KEY:.metadata.annotations.network\.cilium\.io/wg-pub-key'
On an existing cluster

Turning encryption on or off forces a restart of the agents and the operator, and traffic will be interrupted during the change. Plan it as a maintenance window.

Seeing the difference on the wire

Play the attacker: capture traffic on the Docker bridge that connects the kind nodes and look for a token in plain text. Deploy a server and a client on different nodes:

kubectl --context kind-wg create deployment web --image=nginx:stable
kubectl --context kind-wg expose deployment web --port=80
WEB_NODE=$(kubectl --context kind-wg get pod -l app=web -o jsonpath='{.items[0].spec.nodeName}')
OTHER=$(kubectl --context kind-wg get nodes -o name | grep worker | grep -v $WEB_NODE | head -n1 | cut -d/ -f2)
kubectl --context kind-wg run client --image=nicolaka/netshoot \
  --overrides="{\"spec\":{\"nodeName\":\"$OTHER\"}}" -- sleep infinity

# In another terminal (Linux): listen on the kind bridge
BRIDGE=br-$(docker network inspect kind -f '{{.Id}}' | cut -c1-12)
docker run --rm -it --network host --privileged nicolaka/netshoot \
  tcpdump -lAi $BRIDGE | grep --line-buffered Bearer
kubectl --context kind-wg exec client -- \
  curl -s -o /dev/null -H "Authorization: Bearer SECRET-TOKEN" http://web

With encryption on, the grep finds nothing. Now repeat with encryption off (encryption.enabled=false and a restart of the agents and the operator): the token shows up in plain text in the capture. To see the encrypted traffic itself, filter by its port:

docker run --rm -it --network host --privileged nicolaka/netshoot \
  tcpdump -ni $BRIDGE udp port 51871
# IP 172.18.0.3.51871 > 172.18.0.4.51871: UDP, length 144   ← unreadable content

One last experiment: put the client on the host network (hostNetwork: true) and repeat. Without nodeEncryption, that node-to-pod traffic travels in plain text.

Good to know. This test proves that traffic goes through the tunnel and doesn't travel in plain text. It isn't a cryptographic analysis: for that, rely on WireGuard's public review.
# Cleanup
kind delete cluster --name wg

Challenge

Answer before you open the solution.

1. Two pods on the same node talk with WireGuard on. Is the traffic encrypted?

No. The traffic doesn't leave the node; anyone who could see it already controls the node.

2. Which port do you need to allow between nodes for WireGuard?

UDP 51871.

3. How are public keys distributed between nodes?

Each agent publishes its key as an annotation on its CiliumNode and the others read it from the Kubernetes API.

4. A process with hostNetwork calls a pod on another node. What do you need to encrypt it?

Turn on encryption.nodeEncryption, currently in beta.

What you take away

  • Transparent encryption: no changes to the applications, no certificates, no sidecars.
  • By default it encrypts traffic between pods on different nodes, over UDP 51871.
  • It doesn't encrypt inside the node, from the host (unless you use node encryption) or out of the cluster.
  • Keys travel through the Kubernetes API: protect the API server well.
  • Verify it by capturing traffic: the plain-text token disappears.

In the next chapter: observability in depth with Hubble.

Official resources

Source and credits. This chapter summarizes and paraphrases the official book Cilium: Up and Running by Nico Vibert, Filip Nikolic and James Laverack (O'Reilly Media, 2026). The summary was produced with AI and reviewed, verified and approved by Jesús Espinoza. The diagrams and code examples are original work by The House of Routing and were checked against the official Cilium documentation. Cilium: Up and Running, the cover image, and related trade dress are trademarks of O'Reilly Media, Inc. This content is not affiliated with or endorsed by O'Reilly Media or Isovalent.

Navigate