Traffic between pods on different nodes usually crosses the network in clear text. Inside one data center that may be acceptable, but many clusters span availability zones, shared racks or a cloud network you don't control. Compliance rules often ask for encryption in transit, and asking every team to add TLS to every service takes years.
Cilium can encrypt that traffic for you with WireGuard. Each node gets a key pair, builds a WireGuard tunnel to every other node, and sends pod traffic for remote nodes through it. Applications don't change. This guide enables the feature on Cilium 1.20, verifies it from inside the agent, and covers the MTU cost, what happens when keys change, and which traffic stays unencrypted.
How Cilium uses WireGuard
When WireGuard is on, the agent on each node creates an interface called cilium_wg0 and generates its own private key. It publishes the matching public key in the network.cilium.io/wg-pub-key annotation of its CiliumNode object. The other agents read that annotation and add the node as a WireGuard peer, with the node's pod IPs as the peer's allowed IPs.
There is no shared secret to create or store in a Kubernetes Secret, which is the main practical difference from Cilium's IPsec mode. Each node trusts the public keys it reads from the Kubernetes API, so keeping that API safe is what protects the scheme.
Traffic between two pods on the same node is not encrypted. That is by design, because anyone who can watch that traffic is already on the node and could read it before encryption anyway.
Step 1: check the kernel and the firewall
Cilium uses the WireGuard module in the Linux kernel, not a userspace implementation. The module ships with Linux 5.6 and newer, and older kernels need the out-of-tree module. Check each node before you change Cilium, because without the module the agent can't create cilium_wg0.
sudo modprobe wireguard && lsmod | grep wireguard
The tunnel listens on UDP port 51871 on every node. If security groups or host firewalls sit between your nodes, allow UDP 51871 between all of them in both directions. In a Cluster Mesh setup the same port must be open between the nodes of different clusters.
Step 2: enable WireGuard with Helm
Encryption is controlled by two Helm values. encryption.enabled turns the feature on, and encryption.type picks the method. The default type is ipsec, so setting only encryption.enabled=true doesn't give you WireGuard.
For a new installation, pass both values at install time.
helm repo add cilium https://helm.cilium.io/
helm install cilium cilium/cilium --version 1.20.5 \
--namespace kube-system \
--set encryption.enabled=true \
--set encryption.type=wireguard
On an existing cluster, upgrade the release with the same values and restart the agents so they read the new configuration. The restart briefly interrupts each node's datapath, so do it in a maintenance window.
helm upgrade cilium cilium/cilium --version 1.20.5 \
--namespace kube-system \
--reuse-values \
--set encryption.enabled=true \
--set encryption.type=wireguard
kubectl -n kube-system rollout restart daemonset/cilium
kubectl -n kube-system rollout status daemonset/cilium
The chart turns these values into the enable-wireguard key in the cilium-config ConfigMap. You can confirm the rendered value directly.
kubectl -n kube-system get configmap cilium-config -o jsonpath='{.data.enable-wireguard}{"\n"}'
It should print true. If you install with the Cilium CLI instead of Helm, cilium install accepts the same --set flags.
Step 3: check the agent status
The quickest check is the agent's own status output. Run it in one of the Cilium pods.
kubectl -n kube-system exec ds/cilium -- cilium-dbg status | grep Encryption
The line names the interface, the public key, the listen port and the number of peers.
Encryption: Wireguard [cilium_wg0 (Pubkey: <..>, Port: 51871, Peers: 2)]
The peer count should be the number of nodes minus one, since a node doesn't peer with itself. A lower number means some nodes haven't published a key yet or the agent hasn't processed them.
cilium-dbg encrypt status gives a focused view. It reads the WireGuard state from the kernel and asks the agent for its view as well.
kubectl -n kube-system exec ds/cilium -- cilium-dbg encrypt status
Encryption: Wireguard
Interface: cilium_wg0
Public key: <..>
Number of peers: 2
You can also see the published keys from outside the agent. Every CiliumNode should carry the annotation, and every value should be different.
kubectl get ciliumnodes -o custom-columns='NODE:.metadata.name,WG-PUBKEY:.metadata.annotations.network\.cilium\.io/wg-pub-key'
Step 4: watch traffic on cilium_wg0
Status output only shows that the tunnel exists. To see that pod traffic actually uses it, capture on cilium_wg0 while two pods on different nodes talk to each other. Packets on this interface are still in clear text, because the kernel encrypts them as they leave it.
The upstream guide installs tcpdump inside the agent container for this check. Pick the agent pod on the node that runs your client pod.
kubectl -n kube-system exec -ti ds/cilium -- bash
apt-get update
apt-get -y install tcpdump
tcpdump -n -i cilium_wg0
Generate some traffic, for example with curl from a client pod to a pod on another node. Each line tcpdump prints should show the client pod IP and the server pod IP, with the TCP flags and payload in the clear. If the capture stays empty while the request succeeds, the traffic took another path and is not encrypted.
The other half of the test is the physical interface. Capture there with a filter for UDP port 51871 and the same requests show up only as WireGuard datagrams between node IPs. If you can still read the pod-to-pod HTTP request on the node's main interface, that path isn't encrypted.
Step 5: decide on node-to-node encryption
By default Cilium only encrypts traffic between Cilium-managed pods. Traffic from a node to a remote node, from a pod to a remote node and from a node to a remote pod goes out as before. Host-network pods count as node traffic here, so they aren't covered either.
The encryption.nodeEncryption value extends WireGuard to those paths. The Cilium documentation still marks it as beta.
helm upgrade cilium cilium/cilium --version 1.20.5 \
--namespace kube-system \
--reuse-values \
--set encryption.nodeEncryption=true
kubectl -n kube-system rollout restart daemonset/cilium
Control-plane nodes opt out of node-to-node encryption by default. Cilium skips any node matching the node-encryption-opt-out-labels option, which defaults to node-role.kubernetes.io/control-plane. The reason is a bootstrapping problem. A worker whose key changed must update its CiliumNode through the kube-apiserver, and if that connection were itself encrypted with the old key, the worker could lock itself out. Pod traffic on control-plane nodes is still encrypted, and the API server connection is protected by Kubernetes' own TLS.
Plan for the MTU overhead
Every WireGuard packet carries an outer IP header, a UDP header, a WireGuard header and padding. Cilium subtracts a fixed allowance of 95 bytes for this from the MTU it sets on pod routes. With VXLAN or Geneve tunnel mode the packet is encapsulated twice, first by the overlay and then by WireGuard, so Cilium also subtracts the tunnel overhead of 50 bytes over IPv4 or 70 bytes over IPv6.
On a network with 1500-byte frames, native routing leaves pods a route MTU of 1405, and tunnel mode over IPv4 leaves 1355. Expect somewhat lower throughput for bulk transfers and plan jumbo frames on the underlay if you need the room back.
If you run Cilium in CNI chaining mode, for example on top of the AWS VPC CNI, set cni.enableRouteMTUForCNIChaining=true. Without it Cilium can't set the reduced MTU on pod routes, and encrypted traffic may be fragmented.
Understand how keys change
Cilium doesn't rotate WireGuard keys on a schedule, and there is no Secret to update. The agent stores its private key in a file named cilium_wg0.key in its state directory under /var/run/cilium on the host. On start it loads that file, and it only generates a new key pair when the file doesn't exist, as happens after a node is rebuilt or the runtime directory is cleared by a reboot.
When a node comes back with a new key, its agent writes the new public key to its CiliumNode annotation. The other agents notice that the key for that node changed, remove the old peer and add one with the new key. Traffic to that node can drop while the change propagates, which is one more reason to drain nodes before maintenance.
The agent also rejects a key that another node already uses. If two nodes were cloned from the same disk image with the key file inside, the other agents won't add the second one as a peer until it has a key of its own.
Know the limits
A pod can send its first packets to a new remote pod unencrypted. Cilium decides whether to encrypt based on what it knows about the destination IP, and until news of the new endpoint reaches the sending node, the address looks like it is outside the cluster. You can close this gap with egress policies that block traffic to the reserved:world identity or allow only trusted outside addresses, or with the encryption.strictMode.egress.enabled and encryption.strictMode.egress.cidr values, which force traffic to the pod CIDR through the tunnel. Strict egress mode works for IPv4 pod CIDRs only.
encryption.strictMode.ingress.enabled covers the receiving side. It drops cluster-internal pod traffic that didn't arrive through the WireGuard tunnel. It requires WireGuard, isn't supported with CNI chaining, and doesn't cover node-to-node traffic.
Some north-south paths stay in clear text even with node-to-node encryption. When a node forwards a load balancer request to another node with XDP acceleration, or with DSR in a dispatch mode other than Geneve, that hop isn't encrypted. Egress Gateway replies aren't encrypted with XDP acceleration either. In Cluster Mesh every connected cluster must run WireGuard, because mixing encrypted and unencrypted clusters isn't supported.
When packets go missing, compare both ends with cilium-dbg debuginfo --output json | jq .encryption. Each peer's public key must match the key the remote node reports for itself, and the peer's allowed-ips must list the pod IPs running on that remote node.