2

We run tests on Azure Container Instances. My question is rather simple. Is there a way to assign a public static ip address to the containers? Our tests are running and need connection to certain nodes, but how to allow them that if I don't know what the public address will be?

If not what else as an option there is?

Daniel Mann
  • 57,011
  • 13
  • 100
  • 120
WhoAmI
  • 1,013
  • 2
  • 9
  • 19

2 Answers2

0

So the real question is why you need a static IP address in the first place. An ACI already has a fqdn which you can set. e.g. whateveryouchoose.eastus.azurecontainer.io

Also if you trigger a build/deploy from a github action, unless you deleted the ACI and the build/deploy recreates it, it will still have the previous public IP assigned to it.

However, the situation where the IP address may change without you being aware is during maintenance on the container host. I imagine the containers will get migrated to another container host VM and if that happens, new IP address.

Thus if you have your domain name set in Azure Dns Zone as an A record IP address, this becomes problematic. It will break your site until you correct it.

So how do you solve this quick and dirty? Include azure cli in your container and shell script it to check your Azure Dns Zone's A record (az network dns record-set a) and your container's IP address (az container show). If they are different, set the A record to the new one. This of course assumes you have a service principal (includes clientId and clientSecret and tenantId) created already.

David Tam
  • 181
  • 1
  • 3
-1

Unfortunately, it's impossible the assign a static public IP to the Azure Container Instance. Instead, you can create the Container Instance in a VNet, then put the container instance behind an application gateway and assign a static public IP to the application gateway. In this way, you can access the container instance via the static public IP address.

Charles Xu
  • 29,862
  • 2
  • 22
  • 39