'Attaching a private static ip address to Azure Container Instance

I am searching for a solution with static private IPs for my container instances. I will add the Application Gateway to it to also have a static public IP for it.

I am checking https://stackoverflow.com/a/59168070/7267638 and it looks good until "Add the private IP of the container instance into the backend pool of the application gateway". The point which is not clear to me is what to do when I restart the container and add others in the meantime - it can end up with different private IPs.

I need to have them static not only to be able to configure backend pool for the Gateway, but also for internal routing purposes. Without some kind of static config, I would need to reconfigure all services after private IP change to be able to find each other again.

Maybe can I use some kind of internal DNS or use container names or so?



Solution 1:[1]

Private static IPs for ACI is (as of today) not supported. I don't think there is a real workaround here except for checking after a container has been (re-)started if the IP has been changed.

Your best bet might be to use subnets of the minimum required size when putting ACI into a subnet - and only use one ACI per subnet. This way the chance might be lower that the IP actually changes, but still no guarantees there.

Solution 2:[2]

I have been having the same issue and solved it with the alternative @silent mentions. I created a 29'er subnet, which is the smallest you can create on Azure with 3 available addresses (the other 5 are reserved), per Azure Container Instance I am hosting. I register all three available addresses in the backend pool in application gateway, so that it can forward requests to the IP address of the instance. The built-in probing seems to just do this.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 silent
Solution 2