Skip to content

Egress Connectivity Requirements: CCA practice questions

Traffic that leaves a Cilium cluster has to look acceptable to the network outside. Pod IPv4 addresses usually come from private ranges, so by default Cilium masquerades the source of traffic leaving the cluster to the IPv4 address of the node, which the surrounding network can route. The switches enable-ipv4-masquerade and enable-ipv6-masquerade control this per family.

By Ibrahim Yesilay · Published · Updated

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

What Egress Connectivity Requirements covers in CCA

Traffic that leaves a Cilium cluster has to look acceptable to the network outside. Pod IPv4 addresses usually come from private ranges, so by default Cilium masquerades the source of traffic leaving the cluster to the IPv4 address of the node, which the surrounding network can route. The switches enable-ipv4-masquerade and enable-ipv6-masquerade control this per family.

Not every destination should be masqueraded. Cilium leaves traffic to the local node's allocation CIDR alone, and ipv4-native-routing-cidr widens that exclusion when pod addresses are routable across a larger network; in public clouds the VPC range is detected automatically, so pods reach VMs in the same VPC with their own addresses. For finer control the eBPF ip-masq-agent, enabled with ipMasqAgent.enabled, reads a list of nonMasqueradeCIDRs from configuration and falls back to a default list of private and reserved ranges when the file is empty.

Masquerading has two implementations. The eBPF one, enabled with bpf.masquerade=true, is described as the most efficient; it runs on the devices selected for BPF NodePort, handles TCP, UDP and a few ICMP types, and depends on the BPF NodePort feature. The legacy iptables one works on any kernel and masquerades traffic leaving through non-Cilium devices, optionally limited with egress-masquerade-interfaces.

Masquerading to the node address is not enough when an external firewall expects one fixed source. Node IPs change and every node uses its own, so Cilium offers the egress gateway. A cluster-scoped CiliumEgressGatewayPolicy selects source pods with a podSelector, using io.kubernetes.pod.namespace for namespaces, lists destinationCIDRs and optional excludedCIDRs, and names a gateway node through a nodeSelector. The gateway SNATs the matching traffic to an egressIP, the first address of a named interface, or the address of the default-route interface; setting both egressIP and interface makes Cilium ignore the policy. If no node matches the gateway selector, matching traffic is dropped. The feature needs BPF masquerading and the kube-proxy replacement, does not work with Cluster Mesh, and policies apply to new pods only after a short delay.

Egress is also a question of permission and rate. Network policy controls which external destinations are allowed, through the world entity, CIDR rules or toFQDNs with the DNS proxy. The bandwidth manager limits a pod's egress rate from the kubernetes.io/egress-bandwidth annotation, using EDT and eBPF on the native devices, and is off until bandwidthManager.enabled is set.

Key points

  • Masquerading to the node IPv4 address is on by default for traffic leaving the cluster.
  • ipv4-native-routing-cidr and the ip-masq-agent nonMasqueradeCIDRs list keep pod source IPs for routable ranges.
  • Egress gateway requires BPF masquerading and kube-proxy replacement and is incompatible with Cluster Mesh.
  • A CiliumEgressGatewayPolicy is cluster-scoped and selects namespaces with the io.kubernetes.pod.namespace label.

Three sample questions

11 CCA questions on Egress Connectivity Requirements, 11 with explanations. How practice works

Question 1

Pods use private IPv4 addresses and masquerading is at its default setting. What source IP does an external server see for a connection from a pod?
  1. A.The pod IP address, because Cilium never rewrites source addresses
  2. B.A random address from the pod CIDR of the node
  3. C.The IPv4 address of the node the pod runs on
  4. D.The cluster IP of the kube-dns Service

Correct answer: C

Cilium automatically masquerades the source address of all IPv4 traffic leaving the cluster to the node's IPv4 address, because the node address is already routable on the network. This is controlled by enable-ipv4-masquerade, which is on by default. Why the other options are wrong. "The pod IP address, because Cilium never rewrites source add...": Masquerading to the node IP is the default for traffic leaving the cluster. "A random address from the pod CIDR of the node": SNAT uses the node's routable address, not another pod address. "The cluster IP of the kube-dns Service": Service cluster IPs are virtual addresses for in-cluster load balancing. They are not egress source addresses.

Sources: CNCF CCA curriculum (CCA_Curriculum.pdf), Cilium docs: Masquerading, Cilium docs: Routing

Question 2

Pod IPs are routable across the whole corporate network 10.0.0.0/8, and pod traffic to other hosts in that range should keep the pod IP. Which setting does this?
  1. A.enable-ipv4-masquerade: true
  2. B.egress-masquerade-interfaces: 10.0.0.0/8
  3. C.enable-remote-node-masquerade: "true"
  4. D.ipv4-native-routing-cidr: 10.0.0.0/8

Correct answer: D

By default Cilium excludes only destinations in the local node's allocation CIDR from masquerading. If pod IPs are routable across a wider network, that network can be given with ipv4-native-routing-cidr, and destinations inside it are not masqueraded. Why the other options are wrong. "enable-ipv4-masquerade: true": This turns masquerading on, which is already the default. It does not exclude the corporate range. "egress-masquerade-interfaces: 10.0.0.0/8": This iptables-mode option takes interface names such as eth0, not CIDRs. "enable-remote-node-masquerade: "true"": This option masquerades traffic to remote node addresses in BPF mode. It does not keep pod IPs toward a routed range.

Sources: CNCF CCA curriculum (CCA_Curriculum.pdf), Cilium docs: Masquerading, Cilium docs: Routing

Question 3

Which Helm value selects the eBPF-based masquerading implementation, which the docs call the most efficient one?
  1. A.bpf.masquerade=true
  2. B.ipMasqAgent.enabled=true
  3. C.enableIPv4Masquerade=false
  4. D.kubeProxyReplacement=false

Correct answer: A

Cilium has an eBPF-based and a legacy iptables-based masquerading implementation. The eBPF one is enabled with the Helm option bpf.masquerade=true and also enables BPF host routing by default. The iptables implementation works on all kernel versions. Why the other options are wrong. "ipMasqAgent.enabled=true": This adds the eBPF ip-masq-agent for fine-grained non-masquerade CIDRs. It does not choose the implementation. "enableIPv4Masquerade=false": This disables IPv4 masquerading altogether. "kubeProxyReplacement=false": This disables the kube-proxy replacement. The eBPF masquerading implementation actually depends on the BPF NodePort feature.

Sources: CNCF CCA curriculum (CCA_Curriculum.pdf), Cilium docs: Masquerading, Cilium docs: Egress Gateway

Practice this topic

Focus mode keeps every question on Egress Connectivity Requirements 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

What happens if the egress gateway node cannot be selected?

When no node matches the gateway nodeSelector, Cilium drops the traffic that matches the policy's destination CIDRs rather than sending it out through another node.