How does kube-proxy implement Services?
AdvancedConceptKubernetes, Containers, MTU & Performance Basics
Answer
kube-proxy watches Services and EndpointSlices and programs the node's datapath: iptables mode (default, rules per service and endpoint, random probability load balancing), IPVS mode (kernel L4 balancer with real algorithms, scales better) or nftables mode (newer). A packet to ClusterIP is DNAT'd to a pod IP before routing.
iptables -t nat -L KUBE-SERVICES -n | head
ipvsadm -Ln
Cilium can replace kube-proxy entirely with eBPF.
More on Kubernetes, Containers, MTU & Performance Basics
What are the basic Kubernetes networking rules?BeginnerWhat are the Service types in Kubernetes?BeginnerWhat is the difference between a Service and an Ingress?BeginnerHow does DNS work for Services and pods in Kubernetes?IntermediateWhat is a CNI plugin and how do the main ones differ?IntermediateWhat are the trade-offs of AWS VPC CNI?Advanced