<p>I have created a sample API application with Node and Express to be containerized and deployed into Azure Kubernetes Services (AKS). However, I was unable to access the API endpoint through the external API generated from the service.yml that was deployed.</p>
<p>I have made use of deployment center within AKS to deploy my application to AKS and generate the relevant deployment.yml and service.yml. The following is the services running containing the external IP.</p>
<p><a href="https://i.stack.imgur.com/pWAWz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pWAWz.png" alt="enter image description here" /></a></p>
<p>The following is the response from postman. I have tried with or without port number and ip address from <code>kubectl get endpoints</code> but to no avail. The request will timeout eventually and unable to access the api.</p>
<p><a href="https://i.stack.imgur.com/O5a9J.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/O5a9J.png" alt="enter image description here" /></a></p>
<p>The following is the dockerfile config</p>
<p><a href="https://i.stack.imgur.com/D6lBr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/D6lBr.png" alt="enter image description here" /></a></p>
<p>I have tried searching around for solutions, how it was not possible to resolve. I would greatly appreciate if you have encountered similar issues and able to share your experience, thank you.</p>

Richard Rodjues
<p>From client machine where <strong>kubectl</strong> is installed do</p>
<pre><code>kubectl get pods -o wide -n restapicluster5ca2
</code></pre>
<p>this will give you all the pods with the ip of the Pods</p>
<pre><code>kubectl describe svc restapicluster-bb91 -n restapicluster5ca2
</code></pre>
<p>this will give details about the <strong>service</strong> and then check <strong>LoadBalancer Ingress:</strong> for the external IP address, <strong>Port:</strong> for the port to access, <strong>TargetPort:</strong> the port on the containers to access i.e <strong>5000</strong> in your case, <strong>Endpoints:</strong> to verify if all IP of the pod with correct port i.e <strong>5000</strong> is displaying or not.</p>
<p>Log into any of the machines in the AKS cluster do the following</p>
<pre><code>curl [CLUSTER-IP]:[PORT]/api/posts i.e curl 10.-.-.67:5000
</code></pre>
<p>check if you get the response.</p>
<p>For reference to use <strong>kubectl</strong> locally with <strong>AKS</strong> cluster check the links below</p>
<ol>
<li><a href="https://learn.microsoft.com/en-us/azure/aks/kubernetes-walkthrough" rel="nofollow noreferrer">https://learn.microsoft.com/en-us/azure/aks/kubernetes-walkthrough</a></li>
<li><a href="https://learn.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest" rel="nofollow noreferrer">https://learn.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest</a></li>
</ol>
