In Azure Kubernetes Service (AKS) I have a Service of type "ClusterIP", does it perform the pod's load balancing internally?

8/19/2020

Assuming this scenario:

Service A (ClusterIP):

  • Pod1 (Image1)
  • Pod2 (Image1)
  • Pod3 (Image1)

Service B (ClusterIP):

  • Pod1 (Image2)
  • Pod2 (Image2)
  • Pod3 (Image2)

Assuming that I have an Ingress Controller:

/svcA > This will redirect to Service A /svcB > This will redirect to Service B

So my question is, the Service is still doing a Load Balancing between the pods? What if Pod1 of Service A is busy and the request has to be attender by either Pod2 or Pod3 of Service A ?? Who is performing that Load Balancing?

Thanks!

-- Jerry Santana
azure
azure-aks
kubernetes
kubernetes-ingress
nginx

2 Answers

8/19/2020

it will do load balancing, but its not application aware, so if your pod cannot handle the request due to load the request would be lost or the error would be returned. you can use readyness probes to mark pods as not ready, they will not receive traffic in that case

-- 4c74356b41
Source: StackOverflow

8/19/2020

A piece of Kubernetes infrastructure called kube-proxy provides load balancing for ClusterIP services (and NodePort and LoadBalancer services when called from inside the cluster). The actual load balancing depends on the cluster configuration but it usually isn't intelligent; typical out-of-the-box setups will use either round-robin or random routing. The section on Virtual IPs and service proxies in the Kubernetes documentation discusses this in a little more detail.

If the pod deployment-a-pod-1 is so busy that it can't handle requests, a third of requests to service-a will time out. If this backlog also affects the HTTP requests you're using for liveness probes, it will eventually cause the pod to restart, and any outstanding connections to that specific pod will get lost. In both cases the client will have to retry the affected requests.

-- David Maze
Source: StackOverflow