Skip to content

Latest commit

 

History

History
79 lines (70 loc) · 3.43 KB

eks-demo.md

File metadata and controls

79 lines (70 loc) · 3.43 KB

Using ADOT-Collector on Amazon EKS

This example will introduce how to use AWS Distro for OpenTelemetry Collector to send application traces and metrics on AWS EKS. This instruction provided the data emitter image that will generate OTLP format of metrics and traces data to Amazon CloudWatch and X-Ray consoles. Please follow the steps below to try ADOT Collector Beta.

Create EKS-ADOT IAM Policy

  1. Open the IAM console at https://console.aws.amazon.com/iam/.
  2. In the navigation pane, choose Policies.
  3. Choose Create policy, JSON.
  4. Enter the following policy:
{
	"Version": "2012-10-17",
	"Statement": [
		{
			"Effect": "Allow",
			"Action": [
				"logs:PutLogEvents",
				"logs:CreateLogGroup",
				"logs:CreateLogStream",
				"logs:DescribeLogStreams",
				"logs:DescribeLogGroups",
				"xray:PutTraceSegments",
				"xray:PutTelemetryRecords",
				"xray:GetSamplingRules",
				"xray:GetSamplingTargets",
				"xray:GetSamplingStatisticSummaries",
				"ssm:GetParameters"
			],
			"Resource": "*"
		}
	]
}
  1. Choose Review policy.
  2. On the Review policy page, enter EKS-ADOT for the Name and choose Create policy.

Attach EKS-ADOT IAM Role to worker nodes

  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
  2. Select one of the worker node instances and choose the IAM role in the description.
  3. On the IAM role page, choose Attach policies.
  4. In the list of policies, select the check box next to EKS-ADOT. If necessary, use the search box to find this policy.
  5. Choose Attach policies.

Deploy ADOT Collector on Amazon EKS as sidecar

The easiest way to deploy ADOT Collector on Amazon EKS is to run it as a sidecar, defining it in the same pod definition as your application.

  1. Create a Kubernetes namespace.
kubectl create namespace aws-otel-eks
  1. Setup AWS_REGION and CLUSTER_NAME for exporting metrics to CloudWatch
export CLUSTER_NAME=<eks-cluster-name>
export AWS_REGION=<aws-region>
  1. Deploy the application. An example config template can be found here.
  • Replace {{region}} with the name of the region where the logs are published (e.g. us-west-2).
  • Replace {{cluster_name}} with the actual eks cluster name.
cat otel-cloudwatch-sidecar.yaml |
sed "s/{{region}}/$AWS_REGION/g" | 
sed "s/{{cluster_name}}/$CLUSTER_NAME/g" |
kubectl apply -f - 
  1. View the resources in the aws-otel-eks namespace.
kubectl get all -n aws-otel-eks
  1. View the details of the deployed deployment.
kubectl -n aws-otel-eks describe deployment aws-otel-eks-sidecar

The example template provided runs the ADOT Collector as sidecar to send application metrics and traces on Amazon EKS. We run two applications: the customer’s application (aws-otel-emitter) and the ADOT Collector aws-otel-collector. Running the ADOT Collector in the same application as the main application allows the ADOT Collector to collect the metric/trace data for the customer’s application. We also call running the ADOT Collector in this way a "Sidecar".

View Your Metrics
You should now be able to view your metrics in your CloudWatch console. In the navigation bar, click on Metrics. The collected ADOT Collector metrics can be found in the AWSObservability/CloudWatchEKSService namespace. Ensure that your region is set to the region set for your cluster.