Networking
medium

Pregunta de Networking #019e3a4f

Enunciado de la Pregunta
Networking
#kube-proxy
#kubernetes
#service
#networking
#iptables
Medio

What function does kube-proxy provide to a cluster?

A

Implementing the Ingress resource type for application traffic.

B

Forwarding data to the correct endpoints for Services.

Correcto
C

Managing data egress from the cluster nodes to the network.

D

Managing access to the Kubernetes API.

Explicación Oficial / Explicaciones de la Comunidad

Summary

kube-proxy is a network proxy that runs on each node in a Kubernetes cluster. Its primary function is to implement part of the Kubernetes Service concept by maintaining network rules that allow network communication to Pods from network sessions inside or outside the cluster. Specifically, it forwards traffic destined for a Service's ClusterIP to the correct backend Pod endpoints.

How it Works

kube-proxy watches the Kubernetes API server for changes to Service and EndpointSlice (or Endpoints) objects. For each Service, it configures local network rules (e.g., iptables, IPVS, or userspace mode) to redirect traffic sent to the Service's virtual IP (ClusterIP) and port to one of the backing Pods. This load balancing is transparent to clients. The default mode since Kubernetes 1.2 is iptables, which uses DNAT rules to rewrite the destination IP of packets to the selected Pod's IP.

Why the Correct Answer is Right

The correct answer is "Forwarding data to the correct endpoints for Services." This directly describes kube-proxy's core responsibility: it receives traffic destined for a Service and forwards it to the appropriate Pod endpoints based on the Service's selector and load-balancing algorithm.

Why the Incorrect Answers are Wrong

  • Implementing the Ingress resource type for application traffic: This is the role of an Ingress controller (e.g., NGINX Ingress Controller, Traefik), not kube-proxy. Ingress operates at Layer 7 (HTTP/HTTPS) and provides routing rules for external traffic to Services, while kube-proxy operates at Layer 4 (TCP/UDP) for Service traffic.

  • Managing data egress from the cluster nodes to the network: Egress traffic management is typically handled by network policies, egress gateways, or firewall rules, not by kube-proxy. kube-proxy focuses on internal Service-to-Pod traffic, not outbound node traffic.

  • Managing access to the Kubernetes API: Access to the Kubernetes API is managed by authentication (e.g., TLS certificates, tokens), authorization (RBAC), and the API server itself. kube-proxy does not control API access; it only watches the API for configuration changes.

Key Takeaway

kube-proxy is essential for Service networking in Kubernetes, enabling clients to reach Pods via a stable virtual IP without needing to know the individual Pod IPs. It does not handle Ingress, egress, or API access control.