top of page
Vusi Dhlamini

Navigating Traffic in Azure Kubernetes: How Load Balancing with Ingress Controller Works

When deploying an application in an Azure Kubernetes cluster, it's important to understand how traffic flows from the load balancer into the application. In this blog post, we'll explore the different components involved in this process and how they work together to ensure that traffic is properly routed to the application, with the help of the application gateway Ingress controller.


Load balancing is an essential component of any Kubernetes cluster. It is the process of distributing network traffic across multiple servers to ensure that no single server is overloaded. In Azure Kubernetes, load balancing is achieved through the use of a load balancer service, which is exposed by the application gateway Ingress controller.


The application gateway Ingress controller is a Kubernetes object that acts as a gateway for external traffic to access services in a Kubernetes cluster. It provides a single entry point to the cluster and manages the routing of traffic to different services based on the rules defined in the Ingress resource.


When a load balancer service is created, it is assigned a virtual IP address (VIP) that can be used to access the pods. The Ingress controller then maps this VIP to a publicly accessible IP address and DNS name, making the service available to external clients.


The Load Balancer Service in Action

Let's say we have an Azure Kubernetes cluster with three pods running our application. We create a load balancer service to distribute traffic to these pods, and we define an Ingress resource that specifies the rules for routing traffic to the service.


Figure 1: AKS Cluster low level design


Lets use figure 1 as reference, before a request comes into the Ingress controller, it is first received by the Azure application gateway (layer 7 load balancer), which is deployed outside the cluster. The application gateway then routes the traffic through the application gateway Ingress controller, which inspects the traffic and forwards it to the appropriate load balancer service based on the rules defined in the Ingress resource.


The load balancer service then forwards the traffic to one of the three pods based on the load balancing algorithm specified. This pod then processes the request and sends the response back through the load balancer service, which sends it back to the Ingress controller and then to the client.


Cluster IP Service

In addition to the load balancer service, Kubernetes also has a cluster IP service. A cluster IP service is a service that exposes a set of pods to other pods in the cluster. This service is only accessible within the cluster and cannot be accessed from outside the cluster.


The cluster IP service assigns a virtual IP address to a set of pods and ensures that requests made to this virtual IP address are properly routed to the pods. This service is useful for inter-pod communication within the cluster.


To conclude, understanding how traffic flows in an Azure Kubernetes cluster is essential for building scalable and resilient applications. By leveraging the application gateway Ingress controller, load balancer service, and the cluster IP service, you can ensure that your application is highly available, secure, and able to handle a large amount of traffic.

39 views0 comments

Recent Posts

See All

Comments


bottom of page