Imagine the following scenario: I have a virtual network. In it are multiple container groups/instances which needs to communicate among themselves. Each group is in a separate subnet. There is also a application gateway which needs to know the container groups as it routes some traffic to them. Currently the communication works over ip addresses. During deployment I tell the gateway and some container groups which ip addresses they needs to know.
My problem is now that whenever a container groups restarts (whether intentionally or unintentionally) it may gets a new ip address. But everything is still using the old ip address (since how should they know that it changed).
I found no way to specify a static private ip address or hostname or some kind of fqdn which I could safely use. Also a private dns won't work here, since I can't update it. So the name would still resolve to the old ip address.
Does anyone have an idea how network between container groups in a virtual network should be done and which is fine when some container groups restarts or get a new ip address?
The only possible solution I can currently think of is that whenever a image inside of that groups (re)starts it also updates the private dns in azure. But this is something I don't really see as a (good) solution. An image should not have a dependency to a specific host(er). Also I would need to deploy some sort of credentials which is also bad.