使用ECS进行Prometheus DNS服务发现

5 service-discovery amazon-ecs prometheus

我正在尝试使ECS Service Discovery与Prometheus一起使用。

目前,我的ECS容器已添加到Route 53,如下所示:

+-----------------------------------------------+------+--------------------------------------------------------+
|                     Name                      | Type |                         Value                          |
+-----------------------------------------------+------+--------------------------------------------------------+
| my-service.local.                             | SRV  | 1 1 8080 123456-7890-1234-5678-12345.my-service.local. |
| 123456-7890-1234-5678-12345.my-service.local. | A    | 10.0.11.111                                            |
+-----------------------------------------------+------+--------------------------------------------------------+
Run Code Online (Sandbox Code Playgroud)

我假设如果我向ECS添加更多正在运行的容器,那么我将在Route 53中获得更多别名名称为Alias的记录 123456-7890-1234-5678-12345.my-service.local.

在我的Prometheus配置文件中,我在下提供了以下内容scrape_config

    - job_name: 'cadvisor'
      scrape_interval: 5s
      dns_sd_configs:
      - names:
        - 'my-service.local'
        type: 'SRV'
Run Code Online (Sandbox Code Playgroud)

但是,当我在Prometheus中检查目标状态时,会看到以下内容:

Endpoint: http://123456-7890-1234-5678-12345.my-service.local:8080/metrics
State: Down
Error: context deadline exceeded
Run Code Online (Sandbox Code Playgroud)

我不了解DNS服务发现如何与SRV记录一起使用,因此我不确定问题出在哪里。查看AWS ECS Service Discovery如何添加记录,它看起来像是my-service.local映射到123456-7890-1234-5678-12345.my-service.local:8080

但是,看起来Prometheus并没有尝试查找映射到的本地IP列表,123456-7890-1234-5678-12345.my-service.local而是尝试直接从中进行刮取。

我是否缺少一些配置选项来完成这项工作,或者我是否从根本上误解了某些内容?