Sign up for a live Kubernetes or DevSecOps demo

Click here


Learn how to get started with Kubernetes including how to monitor and manage your clusters, view your Kubernetes logs, and how to improve your Kubernetes security

For all but the simplest Kubernetes configurations, efficiently distributing client requests across multiple clusters should be a priority. A load balancer routes requests to clusters in order to optimize performance and ensure the reliability of your application. With a load balancer, the demands on your application are shared equally across clusters so that all available resources are utilized and no single cluster is overburdened.

What is Load Balancing on Kubernetes?

To understand load balancing on Kubernetes, you must first understand some Kubernetes basics: a “pod” in Kubernetes is a set of containers that are related in terms of their function, and a “service” is a set of related pods that have the same set of functions. This level of abstraction insulates the client from the containers themselves. Pods can be created and destroyed by Kubernetes automatically, and they are not expected to be persistent. Since every new pod is assigned a new IP address, IP addresses for pods are not stable; therefore, direct communication between pods is not generally possible. However, services have their own IP addresses which are relatively stable; thus, a request from an external resource is made to a service rather than a pod, and the service then dispatches the request to an available pod.

An external load balancer will apply logic that ensures the optimal distribution of these requests. In order to create one, your clusters must be hosted by a cloud provider or an environment which supports external load balancers and is configured with the correct cloud load balancer provider package. This includes major cloud providers such as AWS, Azure, and GCP. You will also need to install and configure the kubectl command-line tool to communicate with your cluster.