为什么我的ECS服务无法在我的ELB中注册可用的EC2实例? [英] Why can't my ECS service register available EC2 instances with my ELB?

查看:111
本文介绍了为什么我的ECS服务无法在我的ELB中注册可用的EC2实例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个EC2启动配置,可以构建ECS优化的AMI。我有一个自动扩展组,可确保始终有至少两个可用实例。最后,我有了一个负载平衡器。

I've got an EC2 launch configuration that builds the ECS optimized AMI. I've got an auto scaling group that ensures that I've got at least two available instances at all times. Finally, I've got a load balancer.

我正在尝试创建一个ECS服务,该服务将我的任务分布在负载平衡器中的各个实例上。

I'm trying to create an ECS service that distributes my tasks across the instances in the load balancer.

阅读完ECS负载平衡文档后,据我了解,我的ASG不应自动将我的EC2实例注册到ELB,因为ECS会负责。因此,我的ASG没有指定ELB。同样,我的ELB没有任何注册的EC2实例。

After reading the documentation for ECS load balancing, it's my understanding that my ASG should not automatically register my EC2 instances with the ELB, because ECS takes care of that. So, my ASG does not specify an ELB. Likewise, my ELB does not have any registered EC2 instances.

创建ECS服务时,选择ELB并选择ecsServiceRole。创建服务后, ECS实例选项卡中再也看不到任何可用实例。该服务也无法启动任何任务,出现非常普遍的错误...

When I create my ECS service, I choose the ELB and also select the ecsServiceRole. After creating the service, I never see any instances available in the ECS Instances tab. The service also fails to start any tasks, with a very generic error of ...

服务无法放置任务,因为找不到资源

我已经参加了大约两天了,似乎无法弄清楚哪些配置设置没有正确配置。是否有人对导致此功能不起作用的原因有任何想法?

I've been at this for about two days now and can't seem to figure out what configuration settings are not properly configured. Does anybody have any ideas as to what might be causing this to not work?

2015年6月25日更新:

我认为这可能与 ECS_CLUSTER 用户数据设置有关。

I think this may have something to do with the ECS_CLUSTER user data setting.

在我的EC2自动扩展启动配置中,如果我将用户数据输入完全留空,则实例将使用 ECS_CLUSTER 值为默认。发生这种情况时,我会看到一个自动创建的群集,名为默认。在此默认群集中,我看到了实例,并且可以像预期的那样向ELB注册任务。一旦任务在ELB中注册,世界上一切都很好,我的ELB健康检查(HTTP)通过。

In my EC2 auto scaling launch configuration, if I leave the user data input completely empty, the instances are created with an ECS_CLUSTER value of "default". When this happens, I see an automatically-created cluster, named "default". In this default cluster, I see the instances and can register tasks with the ELB like expected. My ELB health check (HTTP) passes once the tasks are registered with the ELB and all is good in the world.

但是,如果我更改了 ECS_CLUSTER 设置为自定义设置,我再也看不到使用该名称创建的集群。如果我手动创建具有该名称的集群,则实例将永远不会在集群中可见。在这种情况下,我无法向ELB注册任务。

But, if I change that ECS_CLUSTER setting to something custom I never see a cluster created with that name. If I manually create a cluster with that name, the instances never become visible within the cluster. I can't ever register tasks with the ELB in this scenario.

有什么想法吗?

推荐答案

最后,最终结果是没有为我的EC2实例分配公共IP地址。看来ECS需要能够直接与每个EC2实例进行通信,这将要求每个实例都具有一个公共IP。我之所以没有分配容器实例的公共IP地址,是因为我想将它们全部放在一个公共负载平衡器的后面,并且每个容器实例都是私有的。

In the end, it ended up being that my EC2 instances were not being assigned public IP addresses. It appears ECS needs to be able to directly communicate with each EC2 instance, which would require each instance to have a public IP. I was not assigning my container instances public IP addresses because I thought I'd have them all behind a public load balancer, and each container instance would be private.

这篇关于为什么我的ECS服务无法在我的ELB中注册可用的EC2实例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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