【以下的问题经过翻译处理】 我正在尝试在EKS Fargate中将Prometheus指标发送到AWS CloudWatch。我在EKS Fargate中部署了kube-prometheus。我按照https://docs.aws.amazon.com/zh_cn/AmazonCloudWatch/latest/monitoring/ContainerInsights-Prometheus-Setup.html的说明进行了操作。部署成功了,我在/aws/containerinsights/<cluster>/prometheus中看到了日志,但是没有嵌入式指标。因此,我尝试添加Prometheus API服务器指标(不确定是否有帮助),方法是按照https://docs.aws.amazon.com/zh_cn/AmazonCloudWatch/latest/monitoring/ContainerInsights-Prometheus-Setup-configure.html进行操作。在将以下内容添加到prometheus-config的ConfigMap中并进行部署后,我收到了"error: error parsing prometheus-eks-fargate.yaml: error converting YAML to JSON: yaml: line 160: did not find expected key":
# Scrape config for API servers
- job_name: 'kubernetes-apiservers'
kubernetes_sd_configs:
- role: endpoints
namespaces:
names:
- default
scheme: https
tls_config:
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
insecure_skip_verify: true
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
relabel_configs:
- source_labels: [__meta_kubernetes_service_name, __meta_kubernetes_endpoint_port_name]
action: keep
regex: kubernetes;https
- action: replace
source_labels:
- __meta_kubernetes_namespace
target_label: Namespace
- action: replace
source_labels:
- __meta_kubernetes_service_name
target_label: Service
之前的configMap如下:
kind: ConfigMap
metadata:
name:prometheus-config
namespace:amazon-cloudwatch