InterviewHubPRO
Section Overview
Q23

Question 23 of 50

Part 2: Kubernetes Architecture & Core Workloads (11 - 25)

46%
DevOps & Kubernetes (50 Qs)•Part 2: Kubernetes Architecture & Core Workloads (11 - 25)

Kubernetes Services Architecture: ClusterIP, NodePort, LoadBalancer, and Kube-proxy iptables vs. IPVS.

Service Abstraction & Packet Flow

Pods are ephemeral—their IP addresses change whenever they restart. A Service provides a stable virtual IP (VIP) and DNS record that load-balances traffic across dynamic Pod endpoints.

ini
1. ClusterIP (Internal only):
   [ Client Pod ] ---> [ Virtual VIP: 10.96.0.10:80 ]
                                 | (Kube-proxy iptables/IPVS rule)
                                 +---> [ Pod 1: 10.244.1.4:8080 ]
                                 +---> [ Pod 2: 10.244.2.9:8080 ]

2. NodePort:
   [ External Client ] ---> [ Any Worker Node IP : 30080 ] ---> [ ClusterIP ] ---> [ Pod ]

3. LoadBalancer:
   [ Cloud Provider NLB/ALB ] ---> [ NodePort ] ---> [ ClusterIP ] ---> [ Pod ]

Service Types Comparison

Service TypeScopeHow It Operates
ClusterIPInternalDefault. Assigns an immutable cluster-internal virtual IP. Only reachable from within the cluster.
NodePortExternalAllocates a static port (default range 30000-32767) across every worker node.
LoadBalancerExternalIntegrates with cloud APIs (AWS NLB, GCP Cloud LB) to provision an external hardware/cloud load balancer routing into NodePorts.
HeadlessInternalclusterIP: None. Bypasses load balancing; DNS queries return the direct Pod IPs (used for stateful databases).

Kube-proxy: iptables vs. IPVS Mode

  • iptables mode: Evaluates rules sequentially ($O(N)$ complexity). At thousands of services, iptables rule updates become a CPU bottleneck.
  • IPVS mode (IP Virtual Server): Implemented via Netfilter hash tables ($O(1)$ complexity). Drastically faster packet routing and supports true load balancing algorithms (Round Robin, Least Connections, Source Hashing).