如何将弹性IP与Fargate容器相关联? [英] How do I associate an Elastic IP with a Fargate container?

查看:75
本文介绍了如何将弹性IP与Fargate容器相关联?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在探索对我的ECS容器使用新的Fargate选项.一个限制是正在运行的任务必须始终可以在同一公共IP地址上访问.

我的第一个想法是分配一个弹性IP,但是我不知道该将其关联什么.似乎弹性IP可以关联到实例(与Fargate无关)或网络接口.但是,如果我将其与ENI关联,则看不到如何确保任务容器具有该网络接口.创建服务时,我看到可以将其放入VPC中.

根据实验,如果我终止一项任务,以便该服务重新启动新任务,或者如果我更新该服务以运行新的任务修订版,则开始运行新任务的容器每次都会有一个新的ENI./p>

是否有某种方法可以确保给定服务具有相同的公用IP地址,即使其任务被杀死并重新启动?

解决方案

Fargate当前不支持ENI分配,因此不可能有与Fargate任务定义相关联的Elastic IP.

与Fargate一起使用静态IP地址的唯一方法是通过带有别名的Application Load Balancer.

I'm exploring using the new Fargate option for my ECS containers. One constraint is that the running task must always be accessible at the same Public IP address.

My first thought was to allocate an Elastic IP but I can't tell what to associate it to. It seems an Elastic IP can be associated to an instance (which is irrelevant for Fargate) or a Network Interface. However, if I associate it with an ENI, I can't see how to ensure my task's container has that Network Interface. When creating a Service, I see that I can put it in a VPC, but that's it.

From experimentation, if I kill a task so that the service restarts a new one, or if I update the service to run a new task revision - the container that starts running the new task will have a new ENI each time.

Is there some way to ensure that a given service has the same public IP address, even if its tasks are killed and restarted?

解决方案

Fargate does not currently support ENI assignment, so it is not possible to have an Elastic IP associated with a Fargate task definition.

The only way you can use a static IP address with Fargate is via the Application Load Balancer with an alias.

这篇关于如何将弹性IP与Fargate容器相关联?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆