<p>We have helm based k8s application where one of the pod (named "auth") Has code that call itself to do CRUD operation for resetting password. </p>

<p>Since it's calling itself, This operation is using endpoint URL <a href="http://localhost:8081/API/authorizations" rel="nofollow noreferrer">http://localhost:8081/API/authorizations</a></p>

<p><strong><em>Issue:</em></strong>
  When deploying same application at on-premises k8s cluster auth pod is not able to connect itself. </p>

<p><strong>Error:</strong>
  <code>{"api":"external","component":"auth","delay":900000000,"error":"Post http://localhost:8081/api/authorizations: dial tcp 10.250.44.31:8081: connect: connection refused","insecureSkipVerify":false,"message":"Request failed, retrying","method":"POST","requestID":"fb9475e8-bcf9-4924-8339-d3d21922f357","severity":"debug","timestamp":"2020-02-10T11:54:29Z","url":"http://localhost:8081/api/authorizations"}</code></p>

<p>Note: 10.250.44.31:8081 is cluster endpoint IP address </p>

<p><strong><em>Expected behavior</em></strong>:
  When running this application at <strong>AWS eks or azure aks</strong>, <strong>it's working</strong> fine with desired operation. </p>

<p><strong><em>Question:</em></strong></p>

<p>1) is it expected behavior for pod to connect to k8s master server ha proxy IP when using localhost endpoint inside pod? </p>

<p>2) for AWS eks and azure aks it's referring to pod URL only, so does it mean that our cluster network has to be troubleshooted for solving this issue? </p>

<p>Thanks with added ∆ points in advance.. </p>

Tejas Sheth
<p>1) is it expected behavior for pod to connect to k8s master server ha proxy IP when using localhost endpoint inside pod?</p>

<blockquote>
  <p>NO, It is not expected to connect to Master API Server for localhost communication</p>
</blockquote>

<p>2) for AWS eks and azure aks it's referring to pod URL only, so does it mean that our cluster network has to be troubleshooted for solving this issue?</p>

<p>Exec into the pod</p>

<blockquote>
  <p>kubectl exec -it "pod-name" -n "namespace" bash</p>
</blockquote>

<p>Once inside the pod, check if some process is listening on port <code>8081</code></p>

<blockquote>
  <p>ps -ef | grep "8081"</p>
</blockquote>

<p>If you find the desired process running and listening on the port, curl the endpoint and check whether you are getting the response back or not</p>

<blockquote>
  <p>curl -v <a href="http://localhost:8081/API/authorizations" rel="nofollow noreferrer">http://localhost:8081/API/authorizations</a></p>
</blockquote>
