Search code examples
kubernetesload-balancingistio

If 'Destination Rule' on Istio is applied, does load balancing of k8s Service not work?


I understand that the k8s Service basically performs Round Robin on Pods.

If I set the weight of the pods using the 'Destination Rule' of the Istio, what happens to RR of the existing k8s Service? Are load balancing rules in k8s Service ignored?


Solution

  • I understand that the k8s Service basically performs ROUND ROBIN on Pods.`

    That's correct. It's explained in the kubernetes documentation here.


    If I set the weight of the pods using the 'Destination Rule' of the Istio, what happens to RR of the existing k8s Service? Are load balancing rules in k8s Service ignored?

    I couldn't find the exact information how it works, so I will explain how I understand it.

    As kubernetes service uses kube-proxy's iptables rules to distribute the requests, I assume that istio destination rule can override it with his own rules, and apply them through envoy sidecar. As all traffic that your mesh services send and receive (data plane traffic) is proxied through Envoy, making it easy to direct and control traffic around your mesh without making any changes to your services.

    So if you want to change the default ROUND ROBIN to other algorithm (e.g. LEAST_CONN, RANDOM) you can just configure that in your destination rule LoadBalancerSettings.SimpleLB. Note that by default the algorithm is also ROUND ROBIN, same as with kubernetes service.

    More about it here.


    Additional resources: