<p>Unable to configure Locality-prioritized load balancing.
There are two nodes with the labels:</p>
<pre><code>  labels:
    kubernetes.io/hostname: test-hw1
    topology.kubernetes.io/region: us
    topology.kubernetes.io/zone: wdc04
</code></pre>
<pre><code>  labels:
    kubernetes.io/hostname: test-hw2
    topology.kubernetes.io/region: eu
    topology.kubernetes.io/zone: fra02
</code></pre>
<p>Service:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: cara
  namespace: default
  labels:
    app: cara
spec:
  selector:
    app: cara
  ports:
    - name: http
      appProtocol: http
      targetPort: http
      port: 8000

  topologyKeys:
    - &quot;kubernetes.io/hostname&quot;
    - &quot;topology.kubernetes.io/zone&quot;
    - &quot;topology.kubernetes.io/region&quot;
    - &quot;*&quot;
</code></pre>
<p>DestinationRule:</p>
<pre><code>apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
  name: cara
spec:
  host: cara.default.svc.cluster.local
  trafficPolicy:
    connectionPool:
      http:
        http1MaxPendingRequests: 1

    outlierDetection:
      consecutive5xxErrors: 2
      baseEjectionTime: 5s
</code></pre>
<p>If the request comes to test-hw1 node it still sometimes gets routed to test-hw2 node without any reason.</p>

<p>Turns out that the issue was in the NodePort service that was accepting traffic from outside. Services by default are load-balancing traffic across the pods, so sometimes connections were routed to the other region <code>istio-ingressgateway</code> pod.
Simply adding <code>externalTrafficPolicy: Local</code> to the service that is accepting traffic from outside on NodePort solved this issue.</p>
