Issues in sending prometheus metrics to cloudwatch in eks fargate

0

I am trying to send prometheus metrics to aws cloudwatch in eks fargate. I deployed kube-prometheus to eks fargate. I followed instruction in https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/ContainerInsights-Prometheus-Setup.html Deployment was successful. I saw logs in /aws/containerinsights/<cluster>/prometheus. But no embedded metrics. So I tried to add prometheus api server metrics (not sure if it will help) by following https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/ContainerInsights-Prometheus-Setup-configure.html After I added the following to ConfigMap of prometheus-config and deploy, I got "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

the configMap before is like:

kind: ConfigMap
metadata:
  name: prometheus-config
  namespace: amazon-cloudwatch

Thanks in advance, Julie

1 Answer
0
Accepted Answer

Thank you so much. I fixed the error in the file: https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container-insights/latest/k8s-deployment-manifest-templates/deployment-mode/service/cwagent-prometheus/prometheus-eks-fargate.yaml It somehow misplaced these lines: kind: ConfigMap metadata: name: prometheus-config namespace: amazon-cloudwatch

Julie
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions