Kube-proxy: Network Routing
What You'll Learn
You'll learn how kube-proxy enables network communication to Kubernetes Services by managing routing rules on each node.
The Traffic Director
Kube-proxy is a network component that runs on every worker node in your Kubernetes cluster. Its primary job is to implement the networking rules that make Services work. Remember, Services provide stable IP addresses and DNS names for accessing groups of Pods—but someone needs to actually route the traffic to the right destination. That's kube-proxy.
Think of kube-proxy as a traffic director at a busy intersection. When traffic (network requests) arrives for a Service, kube-proxy ensures it gets forwarded to one of the healthy Pods backing that Service.
How It Works
Kube-proxy watches the API Server for changes to Services and Endpoints (the list of Pod IPs backing a Service). When it detects changes, it updates the node's network routing rules accordingly.
It typically operates in one of several modes:
- iptables mode (most common): Configures Linux iptables rules to redirect traffic
- IPVS mode: Uses Linux IP Virtual Server for more efficient load balancing
- userspace mode (legacy): Handles traffic directly in user space
When a request arrives at a Service's virtual IP address, kube-proxy's rules intercept it and forward it to an actual Pod IP—essentially performing load balancing at the node level.
The Hidden Plumber
You rarely interact with kube-proxy directly, but it's essential infrastructure. Without it, Service IPs wouldn't route anywhere, and Pod-to-Service communication would fail.
Key Takeaway: Kube-proxy runs on each node and maintains network rules that route Service traffic to the correct backend Pods, making Kubernetes networking transparent to applications.