Attaching a static ip address to Azure Container Instance

懵懂的女人 提交于 2021-01-29 03:01:46

问题


Is there any way we can attach an fixed ip address to Azure Container Instance(ACI).

In AWS we can attach an elastic ip to ec2 instances, but in Azure we have not used any VM , we took Azure Container Instance as a service.

The ip address of Azure container instance will change if we stop and start the Azure Container Instance, but how to create a fixed ip address in Azure ( like Elastic Ip in AWS) and attach to Azure Container Instance.

Thanks in Advance :)


回答1:


For your requirements, firstly what I have to explain is that when you restart the Azure Container Instance, it maybe change the host machine, so it would change the public IP which you can access from the Internet.

To maintain the public IP that accesses from the Internet, you can create the Azure Container Instance in the Vnet, then add an Application Gateway, which has a static public IP, at the front of it. Add the private IP of the container instance into the backend pool of the application gateway. When you do so, you can access the container instance from the static public IP which does not change, even if you restart the container instance.




回答2:


Solution for me

My solution to this problem was to deploy an IP based SSL certificate on the app service plan. Has the effect of fixing the IP address on the service but you can only bind to 443 and 80.

  • Deploy "Service" type of App Service using a Container Instance.
  • Static address and IP based SSL cert deployed to "Service" App Service.
  • Costs about £65 a month to host approx.

May not be suitable for your service but was the most cost effective way for me.

Research

Other options tested trying to find a resolution were:

  1. Deployed Azure Application Gateway with a static public IP address. The App Gateway allows backend pool to be directed to an IP or FQDN endpoint. This appears to be operational although the options from the backend pool appear to allow HTTP and HTTPS only , not custom ports. Maybe this can be manipulated if the TCP service can listen on 80 and web API on 443. App gateway is Layer 7 resource for HTTP and HTTPS traffic only.

  2. Azure Load Balancer. Could only be directed at the VM, Availability Set or VM Scale Set.

  3. Assign static address to the Resource. Not allowed for Container Instances.

  4. Traffic Manager. Doesn't appear to be the correct type of resource for this deployment.

  5. Azure VNET Firewall resource, but was £500 per month and far too expensive for my deployment.



来源:https://stackoverflow.com/questions/59151307/attaching-a-static-ip-address-to-azure-container-instance

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!