<p>I have an AKS cluster, as well as a separate VM. AKS cluster and the VM are in the same VNET (as well as subnet).</p>
<p>I deployed a echo server with the following yaml, I'm able to directly curl the pod with vnet ip from the VM. But when trying that with load balancer, nothing returns. Really not sure what I'm missing. Any help is appreciated.</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: echo-server
  annotations:
    service.beta.kubernetes.io/azure-load-balancer-internal: &quot;true&quot;
spec:
  type: LoadBalancer
  ports:
  - port: 80
    protocol: TCP
    targetPort: 8080
  selector:
    app: echo-server

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: echo-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: echo-server
  template:
    metadata:
      labels:
        app: echo-server
    spec:
      containers:
        - name: echo-server
          image: ealen/echo-server
          ports:
            - name: http
              containerPort: 8080
</code></pre>
<p>The following pictures demonstrate the situation
<a href="https://i.stack.imgur.com/b9KFj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/b9KFj.png" alt="enter image description here" /></a>
<a href="https://i.stack.imgur.com/oG4dF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oG4dF.png" alt="enter image description here" /></a>
<a href="https://i.stack.imgur.com/kQEUM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kQEUM.png" alt="enter image description here" /></a></p>
<p>I'm expecting that when curl the vnet ip from load balancer, to receive the same response as I did directly curling the pod ip</p>

dexian
<p>Found the solution, the only thing I need to do is to add the following to the Service declaration:</p>
<pre><code>externalTrafficPolicy: 'Local'
</code></pre>
<p>Full yaml as below</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: echo-server
  annotations:
    service.beta.kubernetes.io/azure-load-balancer-internal: &quot;true&quot;
spec:
  type: LoadBalancer
  externalTrafficPolicy: 'Local'
  ports:
  - port: 80
    protocol: TCP
    targetPort: 80
  selector:
    app: echo-server
</code></pre>
<p>previously it was set to 'Cluster'.</p>
<hr />
<p>Just got off with azure support, seems like a specific bug on this (it happens with newer version of the AKS), posting the related link here: <a href="https://github.com/kubernetes/ingress-nginx/issues/8501" rel="nofollow noreferrer">https://github.com/kubernetes/ingress-nginx/issues/8501</a></p>
