Monitor EKS Cluster with Container Insight

Monitor EKS Cluster with Container Insight

In this blog, we’ll dive into how to monitor and set up alerts for your containerized applications using Container Insights. This tool allows you to track key metrics like CPU usage, memory utilization, disk I/O, network performance, and pod status. You can configure these alerts for specific pods or nodes to stay ahead of performance issues and ensure your applications run smoothly.

Additionally, Container Insights enables monitoring of events such as container restarts, pod failures, resource throttling, and high latency in network communication. With this comprehensive monitoring setup, you can gain real-time visibility into your containers and respond proactively to any potential bottlenecks.

Step: 1

Attach this policy to your worker node role

  1. CloudWatchAgentServerPolicy

Step: 2

Add a addon by using console or CLI

aws eks create-addon --cluster-name my-cluster-name --addon-name amazon-cloudwatch-observability

Step: 3

Install the custom resource definitions (CRD) by entering the following commmand

curl https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container-insights/main/k8s-quickstart/cwagent-custom-resource-definitions.yaml | kubectl apply --server-side -f -

Step: 4

Run these commands

ClusterName='MyCluster'
RegionName='us-west-2'
curl https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container-insights/main/k8s-quickstart/cwagent-operator-rendered.yaml | sed 's/{{cluster_name}}/'${ClusterName}'/g;s/{{region_name}}/'${RegionName}'/g' | kubectl apply -f -

Step: 5

Deleting Container Insights

ClusterName=my-cluster-name 
RegionName=my-cluster-region
curl https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container-insights/main/k8s-quickstart/cwagent-operator-rendered.yaml | sed 's/{{cluster_name}}/'${ClusterName}'/g;s/{{region_name}}/'${RegionName}'/g' | kubectl delete -f -
curl https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container-insights/main/k8s-quickstart/cwagent-custom-resource-definitions.yaml | kubectl delete -f -

Monitoring

Thank you for reading my blog, and I hope you find it informative and inspiring. If you have any feedback or questions, please feel free to reach out.

LinkedIn