Kubernetes Networking [Level-8: kube-proxy / iptables / IPVS / eBPF]
This is Level 8 of our Kubernetes networking series, and it's where we finally go inside the Service dataplane . Back in Level 3, we learned that a client Pod talks to a Service's ClusterIP, which somehow routes traffic to a backend Pod: Client Pod → Service (10.96.120.50:80) → Backend Pod (10.244.1.10:80) We deliberately left one question unanswered until now: how does traffic sent to that…
Level 8 of our Kubernetes networking series explains how a Service's ClusterIP is actually translated to a real Pod's IP address. While a Service's IP doesn't correspond to a physical interface, kube-proxy mediates traffic from clients to backend Pods. This article delves into the components involved in this process, including iptables, IPVS, and eBPF.
A Service dataplane is responsible for translating the Service IP to one of the backend Pod IPs. Historically, kube-proxy has implemented this using iptables rules, specifically utilizing Destination Network Address Translation (DNAT). DNAT involves rewriting the destination IP address of incoming packets to match one of the backend Pod IPs.
The kube-proxy component runs on every Node as a DaemonSet, monitoring Services and EndpointSlices. It then programs the Node's networking rules to forward traffic to the appropriate backend endpoints. This process differs from traditional iptables-based DNAT, as IPVS (IP Virtual Server) and eBPF offer alternative solutions with improved scalability and performance.
Modern clusters can utilize IPVS, an alternative to DNAT that allows for faster handling of Service traffic. IPVS maintains a hash table of backend endpoints and uses this table to quickly route incoming packets to the correct destination. While IPVS addresses some scaling issues with iptables, eBPF offers an even more modern approach by allowing custom programmatic actions within the Linux kernel, potentially replacing parts of kube-proxy and further optimizing Service networking.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.