Skip to content

Encrypting Traffic in Transit with Cilium: CCA practice questions

Cilium can transparently encrypt traffic between Cilium-managed endpoints on different nodes, without changes to the applications. Three mechanisms are available: IPsec, WireGuard and, as a beta, ztunnel. Encryption is enabled with encryption.enabled=true, and encryption.type selects the method; when the type is omitted it defaults to ipsec.

By Ibrahim Yesilay · Published · Updated

Independent community practice, not affiliated with or endorsed by CNCF or The Linux Foundation.

What Encrypting Traffic in Transit with Cilium covers in CCA

Cilium can transparently encrypt traffic between Cilium-managed endpoints on different nodes, without changes to the applications. Three mechanisms are available: IPsec, WireGuard and, as a beta, ztunnel. Encryption is enabled with encryption.enabled=true, and encryption.type selects the method; when the type is omitted it defaults to ipsec.

With IPsec, the key material is a pre-shared key that you store in a Kubernetes Secret called cilium-ipsec-keys, in the same namespace as Cilium. A missing or misplaced Secret is the first thing to check when agents fail to start after enabling it. Encrypted packets carry the Encapsulating Security Payload header, so a capture filtered on esp shows them. Keys are rotated by replacing the Secret with a higher key ID; old and new keys are used side by side during the transition, and in a Cluster Mesh every cluster must be rotated.

WireGuard needs no shared secret. Each agent generates its own key pair, publishes the public key in the network.cilium.io/wg-pub-key annotation of its CiliumNode object and builds tunnels to every other node over UDP port 51871 through the cilium_wg0 interface. In tunnel routing mode the packet is encapsulated twice, first by VXLAN or Geneve and then by WireGuard. Node-to-node encryption, set with encryption.nodeEncryption=true, extends protection to host traffic; control-plane nodes opt out by default so that a node with a new key can still reach the API server to publish it.

ztunnel takes a different approach: a per-node proxy provides Layer 4 mutual TLS, and namespaces are enrolled with the label io.cilium/mtls-enabled=true. Pod-level enrollment is not supported, both ends of a connection must be enrolled, and Cluster Mesh is not compatible with it today.

Some traffic is deliberately not encrypted. Packets between pods on the same node stay in the clear because they never leave the host. There is also a short window after a new endpoint appears on a remote node: until that information reaches the sender, Cilium treats the address as outside the cluster and sends it unencrypted. Restricting egress to world closes the window, and so does strict mode egress, which enforces encryption for a configured IPv4 pod CIDR. Strict mode ingress, available with WireGuard only, drops cluster-internal pod traffic that did not arrive through the tunnel.

Encryption is separate from authentication. Cilium mutual authentication verifies workload identities with SPIFFE, and the documentation says encryption has to be enabled as well to meet typical service-to-service security requirements.

Key points

  • encryption.type defaults to ipsec when it is not set.
  • WireGuard tunnels use UDP 51871; public keys are published in the CiliumNode annotation network.cilium.io/wg-pub-key.
  • IPsec keys live in the cilium-ipsec-keys Secret in the Cilium namespace.
  • Strict mode ingress requires WireGuard and is not supported with IPsec.

Three sample questions

12 CCA questions on Encrypting Traffic in Transit with Cilium, 12 with explanations. How practice works

Question 1

How does Cilium implement mutual authentication between workloads in its service mesh?
  1. A.It runs the mTLS handshake out-of-band, with workload identities issued by SPIFFE/SPIRE
  2. B.It injects a sidecar proxy into every pod that terminates TLS
  3. C.It replaces all TCP connections with TLS sessions created by the application
  4. D.It treats IPsec encryption alone as mutual authentication between services

Correct answer: A

The Cilium docs describe mTLS-based mutual authentication that brings the handshake out-of-band for regular connections, with identity management provided by SPIFFE: a SPIRE server is the root of trust and SPIRE agents issue identities for workloads. For encryption of the traffic itself, WireGuard or IPsec transparent encryption must be enabled as well. Why the other options are wrong. Sidecar injection: Cilium service mesh is sidecarless and uses a per-node Envoy. Application-created TLS: the feature is transparent to the application. IPsec alone: IPsec encrypts traffic between nodes but is not the identity-based authentication mechanism.

Sources: Cilium docs: Mutual Authentication, Cilium docs: Transparent Encryption

Question 2

Which Cilium transparent encryption method has every node create its own key pair and publish the public key in the network.cilium.io/wg-pub-key annotation of its CiliumNode object?
  1. A.mTLS
  2. B.WireGuard
  3. C.IPsec
  4. D.TLS tunnels

Correct answer: B

With WireGuard, each agent creates its own key pair, distributes the public key through the CiliumNode annotation network.cilium.io/wg-pub-key and builds tunnels to all other nodes over UDP port 51871 (interface cilium_wg0). Why the other options are wrong. "mTLS": Cilium mutual authentication uses SPIFFE identities, not CiliumNode annotations. "IPsec": IPsec keys come from a pre-shared key stored in the Kubernetes secret cilium-ipsec-keys. "TLS tunnels": not a Cilium transparent encryption mode.

Sources: Cilium docs: WireGuard Transparent Encryption, Cilium docs: IPsec Transparent Encryption

Question 3

Which network protocol does Cilium support for pod-to-pod encryption?
  1. A.OpenVPN
  2. B.IPsec
  3. C.SSL
  4. D.SSH tunneling

Correct answer: B

Cilium supports IPsec for encrypting pod-to-pod traffic, which provides secure communication at the IP layer. WireGuard is also supported in newer versions, but IPsec is the classic solution. OpenVPN and SSH tunneling are not natively supported by Cilium.

Practice this topic

Focus mode keeps every question on Encrypting Traffic in Transit with Cilium until you leave it. 10 free guest answers, then a free account; no credit card.

Or open CCA practice across all topics.

Sources

The explanation above was checked against these official documents.

Frequently asked questions

Is traffic between two pods on the same node encrypted?

No. Both the IPsec and WireGuard guides state that traffic destined to the same node is not encrypted, because it can be observed on the node anyway.