【问题标题】:Blocked ports and autoscaling group in awsaws 中的阻塞端口和自动缩放组
【发布时间】:2016-05-31 02:32:37
【问题描述】:

我有一个具有以下设置的自动缩放组:

- name: configure auto-scaling group
      ec2_asg:
        name: "{{ application_name }}-{{ application_environment }}-auto-scaling-group"
        availability_zones:
          - "{{ region }}a"
          - "{{ region }}b"
          - "{{ region }}c"
        state: present
        launch_config_name: "{{ application_name }}-{{ application_environment }}-launch-configuration"
        min_size: 1
        max_size: 2
        region: "{{ region }}"
        desired_capacity: 2
        tags:
          - environment: "{{application_environment}}"
        vpc_zone_identifier:
          - "{{ vpc.subnets[0].id }}"
          - "{{ vpc.subnets[1].id }}"
          - "{{ vpc.subnets[2].id }}"

它正在启动两个 ec2 实例。

在这两个实例上,都有一个运行 nginx 监听端口 80 的服务。我知道我不能使用端口 80 两次。该服务的所需容量为 2,但我愿意在滚动更新期间运行一个。

但是,如果我更新服务和任务定义,我会收到以下错误:

ERROR: (service myapp-testing-service) was unable to place a task because no container instance met all of its requirements. The closest matching (container-instance 24d9d97e-c979-41a3-a438-212390612ae3) is already using a port required by your task. For more information, see the Troubleshooting section of the Amazon ECS Developer Guide.

是的,端口被阻塞了。在这种情况下,我想要发生的是,一个 nginx-service 被删除,新的被占用,另一个被删除,然后被新的替换。

我认为这是默认行为,但看起来不是 - 还是我搞错了?

【问题讨论】:

  • 这是 Amazon Ecs 对吧?
  • 是的,这是 Amazon ECS
  • 好的。尝试更改配置。它应该可以工作。

标签: amazon-web-services amazon-ec2 ansible amazon-ecs


【解决方案1】:

您需要为myapp-testing-service 重新配置 ECS 服务配置。

将最低健康百分比设置为 50。

这将允许您的服务在部署新版本时运行旧版本的 1 个任务。

【讨论】:

  • 嗯,看起来 ansible 缺少该配置 (docs.ansible.com/ansible/ecs_service_module.html) 但我确实在控制台中看到了它。我会检查的。
  • 服务部署的事件顺序是什么?我猜最大健康百分比是 200。
  • 将最大健康百分比设置为 100 可能会有所帮助。但我认为 ECS 失败并弄清楚在哪里部署新任务是可以的。
  • 200%,我试试 100。
  • 100% 有效,现在我想起来,它确实很有意义。
猜你喜欢
  • 1970-01-01
  • 2019-10-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-06-19
  • 2021-04-07
  • 2014-05-06
  • 2020-11-04
相关资源
最近更新 更多