

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 在 Fargate 上的 Kubernetes 中设置从现有 Prometheus 服务器进行摄取
<a name="AMP-onboard-ingest-metrics-existing-Prometheus-fargate"></a>

Amazon Managed Service for Prometheus 支持从在 Fargate 上运行的自行管理 Kubernetes 集群中的 Prometheus 服务器摄取指标。要从 Fargate 上运行的 Amazon EKS 集群中的 Prometheus 服务器摄取指标，请覆盖名为 amp\$1ingest\$1override\$1values.yaml 的配置文件中的默认配置，如下所示：

```
prometheus-node-exporter:
        enabled: false
    
    alertmanager:
        enabled: false
    
    serviceAccounts:
      server:
        name: amp-iamproxy-ingest-service-account
        annotations: 
          eks.amazonaws.com/role-arn: ${IAM_PROXY_PROMETHEUS_ROLE_ARN}
    
    server:
      persistentVolume:
        enabled: false
      remoteWrite:
        - url: https://aps-workspaces.${REGION}.amazonaws.com/workspaces/${WORKSPACE_ID}/api/v1/remote_write
          sigv4:
            region: ${REGION}
          queue_config:
            max_samples_per_send: 1000
            max_shards: 200
            capacity: 2500
```

通过以下命令使用覆盖安装 Prometheus：

```
helm install prometheus-for-amp prometheus-community/prometheus \
                   -n prometheus \
                   -f amp_ingest_override_values.yaml
```

请注意，在 Helm 图表配置中，我们禁用了 Node Exporter 和 Alertmanager，并运行了 Prometheus 服务器部署。

您可以使用以下示例测试查询来验证安装。

```
$ awscurl --region region --service aps "https://aps-workspaces.region_id.amazonaws.com/workspaces/workspace_id/api/v1/query?query=prometheus_api_remote_read_queries"
    {"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"prometheus_api_remote_read_queries","instance":"localhost:9090","job":"prometheus"},"value":[1648461236.419,"0"]}]}}21
```