Reach API endpoint running inside AKS node

Jose Vasques Moreira 21 Reputation points Microsoft Employee
2022-10-21T20:36:37.437+00:00

Hello,

I have a container that runs an executable that listens on localhost:8080/app for a POST and returns me some data. If I run this executable inside a single VM, for example, I'm able to run something like curl vm-ip:8080/app and have the results sent back to me. What I'm trying to do now is to deploy this as a node inside AKS. I've never used AKS before (or Azure for that matter), so I've tried to adapt the following articles to my use case:

https://learn.microsoft.com/en-us/azure/aks/tutorial-kubernetes-deploy-application
https://learn.microsoft.com/en-us/azure/aks/http-application-routing

But I can't seem to make it work. So far, I've confirmed (I think) that the container works, and the webserver is up by running kubectl logs -l app=test-app and seeing that it shows the log from my application indicating success.

Right now, I have some malformed configuration for the ingress server, where I get a 502 Bad Gateway when I try to `curl test-app.

Azure Kubernetes Service (AKS)
Azure Kubernetes Service (AKS)
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
2,319 questions
0 comments No comments
{count} votes

Accepted answer
  1. srbhatta-MSFT 8,581 Reputation points Microsoft Employee
    2022-10-22T07:20:37.733+00:00

    Hello @Jose Vasques Moreira ,
    Welcome to Microsoft QnA.
    AKS (Azure Kubernetes Service) is a container orchestration service. If you have only 1 container that has your application running within it, then you can go for Azure Container Instance, which is fairly simpler than setting up AKS.
    I'll give you the details for both.
    For AKS, don't have to use Ingress in your situation (because your situation looks fairly simpler to me as per the details provided above). You can configure a NodePort service along with kubenet networking and then expose your application on the desired port.
    These require a fair amount of understanding about the Azure environment (for eg, Azure managed identities, etc).

    The easier way would be if you deploy your application on a standalone container instance of Azure - check this tutorial.

    I would highly recommend you to go through the documentation of AKS and ACI (Azure Container Instance) to get more clarity on the "why" of "what" we are doing. I have linked the doc links in this answer for your ease of use.

    EDIT: In both the cases, you will be pulling your image from ACR as per your requirement.

    Please feel free to reach back for any additional information or questions or if you are facing any particular error. Will be happy to help. Thanks.

    Best Regards.

    ----------------

    Please accept as answer if the above information is helpful.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Jose Vasques Moreira 21 Reputation points Microsoft Employee
    2022-10-22T22:07:02.783+00:00

    Thank you @srbhatta-MSFT , I understand that running it in a single container would be simpler, but further down the line I will need to run several instances of this application together as a cluster, communicating with each other etc. What I'm trying to do now is to decide between using VMSS or AKS for this, and I figured the easiest way to do this would be to run it as a single-node cluster to start with, and then move on to multiple instances later after I get a single node working.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.