Day 14 - Monitor performance of EKS Cluster using CloudWatch Container Insights
Welcome to Day 14 of 100 Days of AWS. The topic for today is Monitor performance of EKS Cluster using CloudWatch Container Insights.
Elastic Kubernetes Service(EKS) is the defacto standard for managing the Kubernetes cluster. Using EKS, AWS will take care of most tasks like patching and provisioning your cluster, performing upgrades, etc.
Using CloudWatch container insight, you can collect, summarize, and aggregate metrics and logs for your containerized application and microservices. It currently supports services like:
- Amazon Elastic Container Service(ECS)
- Amazon Elastic Kubernetes Service(EKS)
- Kubernetes platforms on Amazon EC2
These metrics include CPU, Memory, Disk, and network utilization. It also helps us provide diagnostic information like container restart failure to help you quickly isolate and resolve problems.
To launch your Kubernetes Cluster, you can use tools like eksctl. For more info check the following link.
- To deploy CloudWatch Container Insights run the following command
curl https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container-insights/latest/k8s-deployment-manifest-templates/deployment-mode/daemonset/container-insights-monitoring/quickstart/cwagent-fluentd-quickstart.yaml | sed "s/{{cluster_name}}/dev/;s/{{region_name}}/us-west-1/" | kubectl apply -f -
- Where dev is the name of the EKS cluser
- us-west-1 is the region where cluster is deployed
When you execute the above command, it will create the amazon-cloudwatch namespace, set up the CloudWatch and Fluentd agent, create cloudwatch-agent service accounts, and create configmap for cloudwatch agent deploy cloudwatch agent as daemonsets.
serviceaccount/cloudwatch-agent created
clusterrole.rbac.authorization.k8s.io/cloudwatch-agent-role created
clusterrolebinding.rbac.authorization.k8s.io/cloudwatch-agent-role-binding created
configmap/cwagentconfig created
daemonset.apps/cloudwatch-agent created
configmap/cluster-info created
serviceaccount/fluentd created
clusterrole.rbac.authorization.k8s.io/fluentd-role created
clusterrolebinding.rbac.authorization.k8s.io/fluentd-role-binding created
configmap/fluentd-config created
daemonset.apps/fluentd-cloudwatch created
- You can verify the status of CloudWatch and Fluentd pod using below commands
kubectl get pods -n amazon-cloudwatch
NAME READY STATUS RESTARTS AGE
cloudwatch-agent-7rmlk 1/1 Running 0 4m29s
cloudwatch-agent-b9cth 1/1 Running 0 4m29s
cloudwatch-agent-vrgnl 1/1 Running 0 4m29s
fluentd-cloudwatch-29vxd 1/1 Running 0 4m28s
fluentd-cloudwatch-5rvqg 1/1 Running 0 4m28s
fluentd-cloudwatch-h52q4 1/1 Running 0 4m28s NOTE: Attach CloudWatchAgentServerPolicy to the worker node before proceed further
- Now go to the CloudWatch dashboard https://us-west-1.console.aws.amazon.com/cloudwatch , Under Insights, click on Container Insights

- From the drop down select Performance monitoring and under Select clusters, select your EKS cluster.You will see the dashboard like this which display metrics like CPU, memory utilization and various Network statistics across EKS cluster.

- From the drop down you can even select the metrics at the pod level

- OR even at EKS node level

2 Comments
Thanks for sharing I have implemented in our EKS environment its really helpful
Thanks for the CloudWatch Container Insights we have implemented in EKS clusters.