Introduction

How does Kubernetes know where to send traffic for your services? That’s the job of kube-proxy.

Whether you’re accessing a ClusterIP, NodePort, or LoadBalancer — kube-proxy is working behind the scenes to route traffic correctly.

Let’s unpack how it works in a way that’s easy to understand.


What is kube-proxy?

kube-proxy is a network component that runs on every node in your Kubernetes cluster.

It’s responsible for:

  • Handling traffic for Kubernetes Services
  • Managing IP rules and routing
  • Forwarding requests to the right Pods

kube-proxy acts like a traffic router inside your Kubernetes cluster.


How Does kube-proxy Work?

There are two main modes:

  1. iptables mode (default in most clusters)
  2. IPVS mode (faster, better scalability)

When a Service is created, kube-proxy:

  • Watches the API for new Services and Endpoints
  • Sets up IP routing rules (iptables or IPVS)
  • Forwards traffic to one of the available Pods
kubectl get services
kubectl get endpoints

These show what kube-proxy sees and manages.


Example

When you create a service:

apiVersion: v1
kind: Service
metadata:
  name: my-app
spec:
  selector:
    app: my-app
  ports:
    - port: 80
      targetPort: 8080

kube-proxy:

  • Detects the new Service
  • Tracks which Pods match the selector
  • Routes traffic to available Pods via iptables or IPVS

Modes: iptables vs IPVS

FeatureiptablesIPVS
PerformanceGoodExcellent
ScalabilityOK for small/medGreat for large
FeaturesBasic load balancingAdvanced load balancing
SetupDefaultRequires enabling module
kubectl get configmap kube-proxy -n kube-system -o yaml

Check which mode is being used.


Why kube-proxy Matters

Without kube-proxy:

  • No service traffic would be routed
  • Cluster IPs would be unreachable
  • Load balancing across Pods wouldn’t happen

It’s essential for service discovery and communication in Kubernetes.


Conclusion

kube-proxy might be hidden from view, but it’s a core part of your Kubernetes network.

It keeps your services reachable and balanced, so your apps just work — no matter how many Pods you scale up.


→ Learn more: