0
votes

I'm running a flask API which is given as a task to an Azure batch compute node. I'm trying to hit that API from outside using postman and I'm unable to hit it.

The flask API is successfully running inside the nodes and I'm able to hit it with another task but not able to hit from outside of azure batch.

1
We use Batch slightly different in that the nodes reach out to obtain the data required to do it's work. The concept of something else calling into the nodes seems backwards to me, what is your use case?David C
Yes. You are right. Someone will hit the API running inside the Azure batch nodes.deathstroke

1 Answers

0
votes

By default, Azure Batch nodes are not accessible from the outside world. This is for security reasons and because they sit behind a load-balancer which by default doesn't have routing rules defined to get you to the individual nodes.

You can use a NetworkConfiguration specified on the pool to confgiure InboundNATPools which will allow you to define routing rules to address individual nodes in the pool. See https://docs.microsoft.com/en-us/rest/api/batchservice/pool/add#inboundnatpool

I am not an expert on Flask but I believe in your case you will want to do a mapping from say FrontEndPortRange: [30000-31000] to backend port 443 (assuming that's the port your flask API is listening on) - then port 30000 will map to backend port 443 on node 0, 30001 will map to backend port 443 on node 1, etc.