Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Reference

Setting up the CloudWatch agent to collect cluster metrics

1. Prepare IAM Permissions

Go to IAM ConsoleRoles.

Click Create role.

Choose Custom trust policy → select EKS cluster nodes.

  • For EC2 worker nodes: choose EC2 as trusted entity.

  • For Fargate: choose EKS Pod Execution Role.

Attach the managed policy: CloudWatchAgentServerPolicy.

Name it EKS-CloudWatchAgent-Role and Create role.

Go to your EKS clusterNodesEC2 instanceIAM role and attach this role.

2. Create a service account for the CloudWatch agent

cd deployments

kubectl create ns amazon-cloudwatch

kubectl apply -f https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container-insights/latest/k8s-deployment-manifest-templates/deployment-mode/daemonset/container-insights-monitoring/cwagent/cwagent-serviceaccount.yaml

2. Create ConfigMap for the CloudWatch agent + Deploy the CloudWatch agent as a DaemonSet

kubectl apply -f cloudwatch-agent.yaml

This config makes the agent:

  • Listen on UDP 8125 for StatsD metrics.
  • Push them to CloudWatch every 60 seconds.
  • Add useful dimensions (ClusterName, InstanceId).

3. Deploy the metric exporter/collector

kubectl apply -f eureka-collector.yaml