CloudWatch is a service which collects operational and monitoring data in the form of logs, metrics, and events in AWS Cloud platform. It then visualizes the data by using automated dashboards so you can get a unified view of your AWS resources, applications, and services that run in AWS and on-premises.

After deployment of EKS or Kubernetes cluster, there is a need to configure Container Insights to send data to CloudWatch.

A pre-requisite for this setup is a functional Amazon EKS or Kubernetes cluster. If you need reference installation posts we have them available in our website.

Easily Setup Kubernetes Cluster on AWS with EKS

Install Kubernetes Cluster on Ubuntu with kubeadm

Install Kubernetes Cluster on CentOS 7 with kubeadm

Check to confirm kubectl can connect to the Kubernetes API Server.

$ kubectl get nodes
NAME                                            STATUS   ROLES    AGE   VERSION   Ready    <none>   9d    v1.17.9-eks-4c6976   Ready    <none>   9d    v1.17.9-eks-4c6976

Create and Attach a policy to the IAM role of your worker nodes

Open the Amazon EC2 console at and select one of the Worker nodes.

eks policy cloudwatch 01

Choose the IAM role in the description. On the IAM role page, choose Attach policies.

eks policy cloudwatch 02

Select CloudWatchAgentServerPolicy checkbox and attach the policy.

eks policy cloudwatch 03

Setup Container Insights on Amazon EKS

Once the policy has been attached to the EKS worker nodes role proceed to deploy Container Insights on Amazon EKS.

Save your cluster name and region as variables.


Download installation manifest:

curl -O

Update the file to set correct name of cluster and region.

sed -ie "s/{{cluster_name}}/${EKS_CLUSTER_NAME}/;s/{{region_name}}/${EKS_CLUSTER_REGION}/" cwagent-fluentd-quickstart.yaml

Install Container Insights on Amazon EKS with the following command.

kubectl apply -f ./cwagent-fluentd-quickstart.yaml

A number of resources are created as seen in the command execution output:

namespace/amazon-cloudwatch unchanged
serviceaccount/cloudwatch-agent unchanged unchanged unchanged
configmap/cwagentconfig unchanged
daemonset.apps/cloudwatch-agent unchanged
configmap/cluster-info unchanged
serviceaccount/fluentd unchanged unchanged unchanged
configmap/fluentd-config unchanged
daemonset.apps/fluentd-cloudwatch unchanged

Get status of all resources in amazon-cloudwatch namespace.

$ kubectl get all -n amazon-cloudwatch
NAME                           READY   STATUS    RESTARTS   AGE
pod/cloudwatch-agent-lqtfw     1/1     Running   0          5m21s
pod/cloudwatch-agent-lsz92     1/1     Running   0          5m21s
pod/fluentd-cloudwatch-6j2jf   1/1     Running   0          5m17s
pod/fluentd-cloudwatch-dzrdq   1/1     Running   0          5m17s

daemonset.apps/cloudwatch-agent     2         2         2       2            2           <none>          5m22s
daemonset.apps/fluentd-cloudwatch   2         2         2       2            2           <none>          5m18s

We can see all pods are in running state.These were created by daemon sets.

Viewing Container Insights Metrics

After you have Container Insights set up and it is collecting metrics, you can view those metrics in the CloudWatch console.

eks policy cloudwatch 04

Choose Performance Monitoring in the navigation pane from where you can select resource type metrics to view.

More guides:

EKS Kubernetes Persistent Storage with EFS Storage Service

Using Horizontal Pod Autoscaler on Kubernetes EKS Cluster

Enable CloudWatch logging in EKS Kubernetes Cluster

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!

As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.


Please enter your comment!
Please enter your name here