Cloud Native 4 min read

Understanding Kubernetes Load Balancing: Internal and External Strategies

This article explains how Kubernetes implements load balancing both inside the cluster through Services and kube-proxy, and outside the cluster via Ingress controllers or cloud provider load balancers, covering common algorithms such as round‑robin, least connections, consistent hashing, and weighted strategies.

Mike Chen's Internet Architecture
Mike Chen's Internet Architecture
Mike Chen's Internet Architecture
Understanding Kubernetes Load Balancing: Internal and External Strategies

Kubernetes Overview

Kubernetes (K8s) is the most widely used container orchestration platform, designed to handle large‑scale container scheduling and automated deployment. It provides resource scheduling, service discovery, auto‑scaling, rolling upgrades, and self‑healing capabilities.

Core Functionality: Service Discovery + Load Balancing

Service discovery combined with load balancing is the most frequently used feature of Kubernetes.

Internal Load Balancing

Inside the cluster, load balancing is primarily achieved through Service objects, especially ClusterIP , NodePort , and Headless Service . When a client accesses a Service, kube-proxy runs on each Node and forwards incoming traffic to the backend Pods. kube-proxy supports multiple modes, notably iptables and ipvs . The iptables mode uses kernel packet filtering and NAT rules to perform simple round‑robin or random forwarding.

External Load Balancing

Outside the cluster, load balancing is typically handled by an Ingress Controller or by cloud provider load balancers such as ELB or SLB.

Load Balancing Strategies

When using an Ingress Controller or a Service Mesh (e.g., Istio, Linkerd), the following algorithms are commonly employed:

Round Robin : Requests are sent to Pods in order, providing a simple and evenly distributed approach.

Least Connections : New connections are directed to the backend with the fewest active connections, useful when request latency varies significantly.

Consistent Hash / Ring Hash : A hash of a request key (e.g., user ID, IP, Cookie) maps the request to a specific Pod, ideal for cache clusters or scenarios requiring session affinity.

Weighted Round Robin / Weighted Least Connections : Pods are assigned weights (based on CPU, memory, or node performance); higher‑weight Pods receive more traffic, suitable for heterogeneous deployments.

cloud-nativeKubernetesLoad Balancingservice meshIngresskube-proxy
Mike Chen's Internet Architecture
Written by

Mike Chen's Internet Architecture

Over ten years of BAT architecture experience, shared generously!

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.