繁体   English   中英

AWS ECS 任务因无法注册服务发现实例而停止

[英]AWS ECS tasks was stopped with reason The Service Discovery instance could not be registered

我正在尝试使用以下 AWS ECS 任务定义使用 ansible 设置具有服务发现功能的 AWS ECS 服务:

- name: (define) Create gRPC AWS task definition
  ecs_taskdefinition:
    family: "my-grpc"
    region: us-west-1
    network_mode: bridge
    state: present
    execution_role_arn: "arn:aws:iam::495388981531:role/ecs-runtime-agent"
    force_create: yes
    containers:
    - name: "my-grpc"
      image: "my-custom-grpc-image"
      essential: true
      memoryReservation: 256
      portMappings:
        - containerPort: 9000
      healthCheck:
        command: 
          - "CMD-SHELL"
          - "grpc_health_probe -addr=localhost:9000"

以及以下 AWS ECS 服务配置:

- name: (deploy-commit) Start grpc service
  ecs_service:
    name: grpc
    cluster: "my-cluster"
    state: present
    launch_type: EC2
    force_new_deployment: yes
    region: us-west-1
    task_definition: "my-grpc"
    scheduling_strategy: REPLICA
    desired_count: 1
    deployment_configuration:
      deployment_circuit_breaker:
        enable: true
        rollback: true
      maximum_percent: 200
      minimum_healthy_percent: 100
    service_registries:
      - registryArn: "my-aws-cloud-map-service-discovery-arn"
        containerName: "my-grpc"
        containerPort: 9000

我还预先通过 AWS web 控制台创建了服务发现服务。

当我运行它时,在容器上运行的服务能够运行并成功进行健康检查,但 ECS 任务因以下停止原因而停止:

无法注册服务发现实例。

这里出了什么问题? 我找不到任何方法来调试它。

事实证明,我没有在 AWS 云 Map 命名空间上启用 DNS 查询。 启用后,服务发现开始工作,ECS服务运行成功。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM