---
title: Set Up the Agent's Collector on EKS Fargate
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: >-
  Docs > OpenTelemetry in Datadog > Send OpenTelemetry Data to Datadog > DDOT
  Collector > Install > Set Up the Agent's Collector on EKS Fargate
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Set Up the Agent's Collector on EKS Fargate

## Overview{% #overview %}

Deploy the Agent's Collector on Amazon EKS Fargate. The Agent's Collector is the OpenTelemetry Collector that runs alongside the Datadog Agent as a separate process. Because EKS Fargate does not support DaemonSets, the Datadog Agent runs as a sidecar container in each application pod.

{% alert level="info" %}
**Need additional OpenTelemetry components?** If you need components beyond those included in the default package, follow [Add Components to the Agent's Collector](https://docs.datadoghq.com/opentelemetry/setup/ddot_collector/custom_components.md) to extend the Datadog Agent's capabilities. For a list of components included by default, see [OpenTelemetry Collector components](https://docs.datadoghq.com/opentelemetry/agent.md#opentelemetry-collector-components).
{% /alert %}

## Requirements{% #requirements %}

To complete this guide, you need the following:

**Datadog account**:

1. [Create a Datadog account](https://www.datadoghq.com/free-datadog-trial/) if you don't have one.
1. Find or create your [Datadog API key](https://app.datadoghq.com/organization-settings/api-keys/).

**Software**:

- An EKS cluster with a [Fargate profile](https://docs.aws.amazon.com/eks/latest/userguide/fargate-profile.html) configured.
- [kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl)

**Network**: Allow traffic to the ports used by the configured export path:

| Export path                                  | Protocol             | Default port | Destination                                   |
| -------------------------------------------- | -------------------- | ------------ | --------------------------------------------- |
| Traces, metrics, and logs exported over OTLP | OTLP (gRPC/HTTP)     | 4317 / 4318  | Datadog Agent OTLP receiver or DDOT Collector |
| Traces exported in Datadog format            | Datadog trace intake | 8126 (TCP)   | Datadog Trace Agent                           |
| Runtime metrics exported through DogStatsD   | DogStatsD            | 8125 (UDP)   | DogStatsD server                              |

If the OTLP receiver uses a different port, allow traffic to that port instead.

## Install the Datadog Agent with OpenTelemetry Collector{% #install-the-datadog-agent-with-opentelemetry-collector %}

{% alert level="info" %}
This installation is required for both DDOT SDK + Agent's Collector and upstream OpenTelemetry SDK + Agent's Collector configurations. In this route, the Agent's Collector receives and forwards OTLP metrics and logs.
{% /alert %}

### Set up Datadog API key{% #set-up-datadog-api-key %}

Store the Datadog API key as a Kubernetes secret:

```shell
kubectl create secret generic datadog-secret \
  --from-literal api-key=<DD_API_KEY>
```

Replace `<DD_API_KEY>` with your actual Datadog API key.

### Add the Datadog Agent sidecar to your pod spec{% #add-the-datadog-agent-sidecar-to-your-pod-spec %}

Add the Datadog Agent as a sidecar container in your application's pod spec. The agent and application containers share the same pod network namespace, so the application sends OTLP data to `localhost`.

{% alert level="info" %}
The Datadog Agent image must be `public.ecr.aws/datadog/agent:latest-full`. The `latest-full` image includes the Agent's Collector. The standard `latest` image does not.
{% /alert %}

In the `deployment.yaml` file:

```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: <SERVICE>
spec:
  selector:
    matchLabels:
      app: <SERVICE>
  template:
    metadata:
      labels:
        app: <SERVICE>
    spec:
      containers:
        - name: <SERVICE>
          image: <APP_IMAGE>
          env:
            - name: OTEL_EXPORTER_OTLP_ENDPOINT
              value: "http://localhost:4317"
            - name: OTEL_EXPORTER_OTLP_PROTOCOL
              value: "grpc"
            - name: OTEL_SERVICE_NAME
              value: "<SERVICE>"
            - name: OTEL_RESOURCE_ATTRIBUTES
              value: "service.version=<VERSION>,deployment.environment.name=<ENV>"
        - name: datadog-agent
          image: public.ecr.aws/datadog/agent:latest-full
          env:
            - name: DD_API_KEY
              valueFrom:
                secretKeyRef:
                  name: datadog-secret
                  key: api-key
            - name: DD_SITE
              value: "<DATADOG_SITE>"
            - name: DD_OTELCOLLECTOR_ENABLED
              value: "true"
            - name: DD_OTELCOLLECTOR_INSTALLATION_METHOD
              value: "eks-fargate"
            - name: DD_EKS_FARGATE
              value: "true"
            - name: DD_LOGS_ENABLED
              value: "true"
            - name: DD_LOGS_CONFIG_CONTAINER_COLLECT_ALL
              value: "true"
```

Replace the following placeholders:

- `<SERVICE>`: The name of your service.
- `<APP_IMAGE>`: Your application container image.
- `<VERSION>`: The version of your service.
- `<ENV>`: Your deployment environment (for example, `production`).
- `<DATADOG_SITE>`: Your [Datadog site](https://docs.datadoghq.com/getting_started/site.md). Your site is <YOUR_DATADOG_SITE>. (Ensure the correct DATADOG SITE is selected on the right.)

### Configure EKS resource detection{% #configure-eks-resource-detection %}

The `infraattributes` processor in the Agent's Collector enriches your telemetry with EKS infrastructure tags when Kubernetes resource attributes are present. Add the EKS resource detector to your OpenTelemetry SDK, or configure the `resourcedetection` processor in your collector configuration.

**Using the OpenTelemetry SDK (recommended)**: Add the AWS EKS resource detector to your application. This provides attributes such as `cloud.provider`, `cloud.platform`, `k8s.cluster.name`, and Fargate-specific metadata.

**Using the collector's `resourcedetection` processor**: If you control the collector configuration, add the `eks` and `env` detectors:

In the `otel-config.yaml` file:

```yaml
processors:
  resourcedetection:
    detectors: [env, eks]
    timeout: 2s
    override: false
```

Add `resourcedetection` to your pipeline processors alongside `infraattributes`:

In the `otel-config.yaml` file:

```yaml
service:
  pipelines:
    traces:
      receivers: [otlp]
      processors: [resourcedetection, infraattributes]
      exporters: [datadog, datadog/connector]
    metrics:
      receivers: [otlp, datadog/connector]
      processors: [resourcedetection, infraattributes, cumulativetodelta]
      exporters: [datadog]
    logs:
      receivers: [otlp]
      processors: [resourcedetection, infraattributes]
      exporters: [datadog]
```

## Send your telemetry to Datadog{% #send-your-telemetry-to-datadog %}

To send your telemetry data to Datadog:

1. Instrument your application
1. Correlate observability data
1. Run your application

### Instrument the application{% #instrument-the-application %}

Instrument your application [using the OpenTelemetry API](https://docs.datadoghq.com/tracing/trace_collection/custom_instrumentation/otel_instrumentation.md).

{% collapsible-section %}
Example application instrumented with the OpenTelemetry API
As an example, you can use the [Calendar sample application](https://github.com/DataDog/opentelemetry-examples/tree/main/apps/rest-services/java/calendar) that's already instrumented for you. The following code instruments the [CalendarService.getDate()](https://github.com/DataDog/opentelemetry-examples/blob/main/apps/rest-services/java/calendar/src/main/java/com/otel/service/CalendarService.java#L27-L48) method using the OpenTelemetry annotations and API:

In the `CalendarService.java` file:

```java
@WithSpan(kind = SpanKind.CLIENT)
public String getDate() {
    Span span = Span.current();
    span.setAttribute("peer.service", "random-date-service");
    ...
}
```

{% /collapsible-section %}

### Correlate observability data{% #correlate-observability-data %}

[Unified service tagging](https://docs.datadoghq.com/getting_started/tagging/unified_service_tagging.md) ties observability data together in Datadog so you can navigate across metrics, traces, and logs with consistent tags.

In containerized environments, set `env`, `service`, and `version` using OpenTelemetry Resource Attributes environment variables. The Agent's Collector detects this tagging configuration and applies it to the data it collects from containers.

The `OTEL_SERVICE_NAME` and `OTEL_RESOURCE_ATTRIBUTES` environment variables in the deployment manifest above configure unified service tagging.

### Run the application{% #run-the-application %}

Apply the updated deployment manifest:

```shell
kubectl apply -f deployment.yaml
```

After the updated pods are running, unified service tagging is fully enabled for your metrics, traces, and logs.

### Validate the deployment{% #validate-the-deployment %}

1. Verify that all containers in the pod are running:

   ```shell
   kubectl get pods -l app=<SERVICE>
   ```

Use Datadog to explore the observability data for your application.

### Logs{% #logs %}

View logs to monitor and troubleshoot application and system operations.

{% image
   source="https://docs.dd-static.net/images/opentelemetry/embedded_collector/logs.3399501b14c5a2c7bf9ab8dd4aa8bf52.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/opentelemetry/embedded_collector/logs.3399501b14c5a2c7bf9ab8dd4aa8bf52.png?auto=format&fit=max&w=850&dpr=2 2x"
   alt="View logs from the Log Explorer." /%}

### Traces{% #traces %}

View traces and spans to observe the status and performance of requests processed by your application, with infrastructure metrics correlated in the same trace.

{% image
   source="https://docs.dd-static.net/images/opentelemetry/embedded_collector/traces.0dfe8b50575dbfcea5b0d06131826db9.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/opentelemetry/embedded_collector/traces.0dfe8b50575dbfcea5b0d06131826db9.png?auto=format&fit=max&w=850&dpr=2 2x"
   alt="View traces from the Trace Explorer." /%}

### Runtime metrics{% #runtime-metrics %}

Monitor your runtime (JVM) metrics for your applications.

{% image
   source="https://docs.dd-static.net/images/opentelemetry/embedded_collector/metrics.1f91a119276f91ecfb2976f16eed58ef.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/opentelemetry/embedded_collector/metrics.1f91a119276f91ecfb2976f16eed58ef.png?auto=format&fit=max&w=850&dpr=2 2x"
   alt="View JVM metrics from the JVM Metrics dashboard" /%}

### Collector health metrics{% #collector-health-metrics %}

View metrics from the Agent's Collector to monitor the Collector health.

{% image
   source="https://docs.dd-static.net/images/opentelemetry/embedded_collector/dashboard.f6e65b6b9a8708b1a7e172da215947af.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/opentelemetry/embedded_collector/dashboard.f6e65b6b9a8708b1a7e172da215947af.png?auto=format&fit=max&w=850&dpr=2 2x"
   alt="View Collector health metrics from the OTel dashboard." /%}

## Further reading{% #further-reading %}

Additional helpful documentation, links, and articles:

- [Add Components to the Agent's Collector](https://docs.datadoghq.com/opentelemetry/setup/ddot_collector/custom_components.md)
