Skip to content

How do I only capture metrics in AWS container insights from a specific namespace in EKS

0

Hi,

I am trying to limit the metrics collected on my cluster to metrics only from containers in a specific namespace. I have tried using the annotation aws.amazon.com/cloudwatch-agent-ignore: "true" in my deployment yaml for containers that I don't want to send metrics, but that has had no effect. Any idea how to accomplish this, I can find nothing in the online documentation.

Thanks

Paul.

1 Answer
0

To capture metrics only from a specific namespace in AWS Container Insights for EKS, you need to modify the cloudwatch-agent-configmap and ensure the CloudWatch agent is filtering metrics based on the namespace.

  1. Update the cloudwatch-agent-configmap in the amazon-cloudwatch namespace to include the namespace filter.
apiVersion: v1
kind: ConfigMap
metadata:
  name: cloudwatch-agent-config
  namespace: amazon-cloudwatch
data:
  agent.json: |
    {
      "agent": {
        "region": "us-east-1"
      },
      "logs": {
        "metrics_collected": {
          "kubernetes": {
            "cluster_name": "your-cluster-name",
            "metrics_collection_interval": 60,
            "resources": [
              {
                "type": "Namespace",
                "pattern": "your-namespace"
              }
            ]
          }
        }
      }
    }

Apply the Updated ConfigMap Apply the updated ConfigMap using:

answered 8 months ago
  • I applied the following configmap and nothing has changed, it is still collecting metrics from all namespaces - {"agent":{"region":"eu-central-1"},"logs":{"metrics_collected":{"application_signals":{"hosted_in":"example"},"kubernetes":{"cluster_name":"example","enhanced_container_insights":true,"resources":[{"pattern":"example","type":"Namespace"}]}}},"traces":{"traces_collected":{"application_signals":{}}}}

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.