We use a headless service to balance traffic, but progers do not like this option. Installed istio, I read the documentation, but my eyes run wide.
Now the task is:
Balance traffic to the service, in my case: results-service2.predprod.svc.cluster.local
Do I understand correctly that it is enough for me to create a DestinationRule
and all incoming traffic to results-service2.predprod.svc.cluster.local
will be balanced on replicas using the LEAST_CONN
balancing algorithm?
In my case:
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: results-load-balancer
spec:
host: results-service2.predprod.svc.cluster.local
trafficPolicy:
loadBalancer:
simple: LEAST_CONN
Istio destination rule is place to define service load balancing algorithm. By default istio uses "LEAST_REQUEST" as LB algorithm. "LEAST_CONN" is deprecated algorithm. More details are mentioned in istio documentation. If you would like to change LB algorithm to "ROUND_ROBIN" or another supported methon this can be done as per below sample
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: configure-client-mtls-dr-with-workloadselector
spec:
host: example.com
workloadSelector:
matchLabels:
app: ratings
trafficPolicy:
loadBalancer:
simple: ROUND_ROBIN