---
title: Install and configure NRDOT on Kubernetes to monitor Elasticsearch (Manifest)
source: https://docs.newrelic.com/docs/opentelemetry/integrations/elasticsearch/install-configure/kubernetes/nrdot-manifest-install
---

This guide shows how to deploy NRDOT on Kubernetes using a manifest install to automatically discover your Elasticsearch pods, collect cluster, node, and JVM metrics, and stream them to New Relic to monitor your cluster's health and performance.

## Compatibility and requirements [#requirements]

### Supported

-   Elasticsearch 7.16 or later, running as pods in a Kubernetes cluster
-   Manifest install method

### You need

-   A New Relic [license key](https://docs.newrelic.com/docs/apis/intro-apis/new-relic-api-keys/#ingest-license-key)
-   `kubectl` access to your Kubernetes cluster
-   The base [Kubernetes OpenTelemetry manifest installation](https://docs.newrelic.com/docs/kubernetes-pixie/k8s-otel/install/#manifest-install) already completed
-   An Elasticsearch user with the `monitor` or `manage` cluster privilege (see [Elasticsearch security privileges](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-privileges.html))
-   Outbound HTTPS (port 443) connectivity to New Relic's [OTLP endpoint](https://docs.newrelic.com/docs/opentelemetry/best-practices/opentelemetry-otlp)
-   An Elasticsearch username and password (if your cluster requires authentication)

## Set up pod labels [#pod-labels]

Each Elasticsearch pod must have the label `app: elasticsearch` for automatic discovery to work. Without this label, the collector won't detect or monitor your pods.

If you're using a StatefulSet or Deployment for Elasticsearch, add the label in the pod template:

```yaml
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: elasticsearch
spec:
  template:
    metadata:
      labels:
        app: elasticsearch  # Required for auto-discovery
    spec:
      containers:
      - name: elasticsearch
        image: docker.elastic.co/elasticsearch/elasticsearch:8.x.x
```

For existing pods without the label, update your StatefulSet/Deployment and restart the pods:

```bash
kubectl label pods -l <your-existing-selector> app=elasticsearch -n <namespace>
```

You can verify labels are set correctly:

```bash
kubectl get pods -n <namespace> --show-labels
```

## Prepare the collector image and settings [#prepare]

Update the collector image, then define its Elasticsearch monitoring configuration in your local manifest files. You apply these changes to your cluster in the next step.

1.  Update the collector image to NRDOT in both [`deployment.yaml`](https://github.com/newrelic/helm-charts/blob/master/charts/nr-k8s-otel-collector/examples/k8s/rendered/deployment.yaml) and [`daemonset.yaml`](https://github.com/newrelic/helm-charts/blob/master/charts/nr-k8s-otel-collector/examples/k8s/rendered/daemonset.yaml) in your local `rendered` directory:

    ```yaml
    image: newrelic/nrdot-collector:latest
    ```

2.  Update [`deployment-configmap.yaml`](https://github.com/newrelic/helm-charts/blob/master/charts/nr-k8s-otel-collector/examples/k8s/rendered/deployment-configmap.yaml) for Elasticsearch monitoring: set `rule` to match your pod label, and set the cluster name in both `resource/cluster` and `resource/cluster_name_override`. Then choose one of two options:

    **Option 1**: Replace all existing OpenTelemetry components (recommended for Elasticsearch-only monitoring). Replace the entire file's content with:

    ```yaml
    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: nr-k8s-otel-collector-deployment-config
    data:
      config.yaml: |
        extensions:
          health_check:
            endpoint: 0.0.0.0:13133
          k8s_observer:
            auth_type: serviceAccount
            observe_pods: true
            observe_nodes: true

        receivers:
          jaeger: null
          zipkin: null
          prometheus: null
          otlp: null
          receiver_creator/elasticsearch:
            watch_observers: [k8s_observer]
            receivers:
              elasticsearch:
                rule: type == "pod" && labels["app"] == "elasticsearch"
                config:
                  endpoint: 'http://`endpoint`:9200'
                  collection_interval: 15s
                  metrics:
                    elasticsearch.os.cpu.usage:
                      enabled: true
                    elasticsearch.cluster.data_nodes:
                      enabled: true
                    elasticsearch.cluster.health:
                      enabled: true
                    elasticsearch.cluster.in_flight_fetch:
                      enabled: true
                    elasticsearch.cluster.nodes:
                      enabled: true
                    elasticsearch.cluster.pending_tasks:
                      enabled: true
                    elasticsearch.cluster.shards:
                      enabled: true
                    elasticsearch.cluster.state_update.time:
                      enabled: true
                    elasticsearch.index.documents:
                      enabled: true
                    elasticsearch.index.operations.merge.current:
                      enabled: true
                    elasticsearch.index.operations.time:
                      enabled: true
                    elasticsearch.node.cache.count:
                      enabled: true
                    elasticsearch.node.cache.evictions:
                      enabled: true
                    elasticsearch.node.cache.memory.usage:
                      enabled: true
                    elasticsearch.node.shards.size:
                      enabled: true
                    elasticsearch.node.cluster.io:
                      enabled: true
                    elasticsearch.node.documents:
                      enabled: true
                    elasticsearch.node.disk.io.read:
                      enabled: true
                    elasticsearch.node.disk.io.write:
                      enabled: true
                    elasticsearch.node.fs.disk.available:
                      enabled: true
                    elasticsearch.node.fs.disk.total:
                      enabled: true
                    elasticsearch.node.http.connections:
                      enabled: true
                    elasticsearch.node.ingest.documents.current:
                      enabled: true
                    elasticsearch.node.ingest.operations.failed:
                      enabled: true
                    elasticsearch.node.open_files:
                      enabled: true
                    elasticsearch.node.operations.completed:
                      enabled: true
                    elasticsearch.node.operations.current:
                      enabled: true
                    elasticsearch.node.operations.get.completed:
                      enabled: true
                    elasticsearch.node.operations.time:
                      enabled: true
                    elasticsearch.node.shards.reserved.size:
                      enabled: true
                    elasticsearch.index.shards.size:
                      enabled: true
                    elasticsearch.os.cpu.load_avg.1m:
                      enabled: true
                    elasticsearch.os.cpu.load_avg.5m:
                      enabled: true
                    elasticsearch.os.cpu.load_avg.15m:
                      enabled: true
                    elasticsearch.os.memory:
                      enabled: true
                    jvm.gc.collections.count:
                      enabled: true
                    jvm.gc.collections.elapsed:
                      enabled: true
                    jvm.memory.heap.max:
                      enabled: true
                    jvm.memory.heap.used:
                      enabled: true
                    jvm.memory.heap.utilization:
                      enabled: true
                    jvm.threads.count:
                      enabled: true
                    elasticsearch.index.segments.count:
                      enabled: true
                    elasticsearch.index.operations.completed:
                      enabled: true
                    elasticsearch.node.script.cache_evictions:
                      enabled: false
                    elasticsearch.node.cluster.connections:
                      enabled: false
                    elasticsearch.node.pipeline.ingest.documents.preprocessed:
                      enabled: false
                    elasticsearch.node.thread_pool.tasks.queued:
                      enabled: false
                    elasticsearch.cluster.published_states.full:
                      enabled: false
                    jvm.memory.pool.max:
                      enabled: false
                    elasticsearch.node.script.compilation_limit_triggered:
                      enabled: false
                    elasticsearch.node.shards.data_set.size:
                      enabled: false
                    elasticsearch.node.pipeline.ingest.documents.current:
                      enabled: false
                    elasticsearch.cluster.state_update.count:
                      enabled: false
                    elasticsearch.node.fs.disk.free:
                      enabled: false
                    jvm.memory.nonheap.used:
                      enabled: false
                    jvm.memory.pool.used:
                      enabled: false
                    elasticsearch.node.translog.size:
                      enabled: false
                    elasticsearch.node.thread_pool.threads:
                      enabled: false
                    elasticsearch.cluster.state_queue:
                      enabled: false
                    elasticsearch.node.translog.operations:
                      enabled: false
                    elasticsearch.memory.indexing_pressure:
                      enabled: false
                    elasticsearch.node.ingest.documents:
                      enabled: false
                    jvm.classes.loaded:
                      enabled: false
                    jvm.memory.heap.committed:
                      enabled: false
                    elasticsearch.breaker.memory.limit:
                      enabled: false
                    elasticsearch.indexing_pressure.memory.total.replica_rejections:
                      enabled: false
                    elasticsearch.breaker.memory.estimated:
                      enabled: false
                    elasticsearch.cluster.published_states.differences:
                      enabled: false
                    jvm.memory.nonheap.committed:
                      enabled: false
                    elasticsearch.node.translog.uncommitted.size:
                      enabled: false
                    elasticsearch.node.script.compilations:
                      enabled: false
                    elasticsearch.node.pipeline.ingest.operations.failed:
                      enabled: false
                    elasticsearch.indexing_pressure.memory.limit:
                      enabled: false
                    elasticsearch.breaker.tripped:
                      enabled: false
                    elasticsearch.indexing_pressure.memory.total.primary_rejections:
                      enabled: false
                    elasticsearch.node.thread_pool.tasks.finished:
                      enabled: false

        processors:
          memory_limiter:
            check_interval: 60s
            limit_mib: ${env:NEW_RELIC_MEMORY_LIMIT_MIB}
          cumulativetodelta: {}
          attributes/cluster_state_aggregate:
            include:
              match_type: strict
              metric_names:
                - elasticsearch.cluster.state_update.time
            actions:
              - key: type
                action: delete
              - key: state
                action: delete
          filter/critical_operations:
            metrics:
              datapoint:
                - 'attributes["operation"] == "query" or attributes["operation"] == "index" or attributes["operation"] == "get" or attributes["operation"] == "merge" or attributes["operation"] == nil'
          resource/cluster:
            attributes:
              - key: k8s.cluster.name
                value: "elasticsearch-cluster"
                action: insert
          resource/cluster_name_override:
            attributes:
              - key: elasticsearch.cluster.name
                value: "elasticsearch-cluster"
                action: upsert
          resourcedetection:
            detectors: [env, system]
            system:
              resource_attributes:
                host.name:
                  enabled: true
                host.id:
                  enabled: false
                os.type:
                  enabled: true
          batch:
            timeout: 30s
            send_batch_size: 2048
            send_batch_max_size: 4096
          attributes/cardinality_reduction:
            actions:
              - key: process.pid
                action: delete
              - key: process.parent_pid
                action: delete
              - key: k8s.pod.uid
                action: delete
          transform/metadata_nullify:
            metric_statements:
              - context: metric
                statements:
                  - set(description, "")
                  - set(unit, "")

        exporters:
          otlp_http:
            endpoint: "${env:NEWRELIC_OTLP_ENDPOINT}"
            headers:
              api-key: "${env:NEWRELIC_LICENSE_KEY}"
            compression: gzip
            timeout: 30s
            retry_on_failure:
              enabled: true
              initial_interval: 5s
              max_interval: 30s
              max_elapsed_time: 300s

        service:
          extensions: [health_check, k8s_observer]
          pipelines:
            traces: null
            logs: null
            metrics: null
            metrics/elasticsearch:
              receivers: [receiver_creator/elasticsearch]
              processors: [memory_limiter, resourcedetection, resource/cluster, resource/cluster_name_override, attributes/cardinality_reduction, filter/critical_operations, attributes/cluster_state_aggregate, cumulativetodelta, transform/metadata_nullify, batch]
              exporters: [otlp_http]
    ```

    **Option 2**: Merge with existing configuration (if monitoring multiple services). Add the Elasticsearch receiver and processors to your existing configuration, merging them with your current `deployment-configmap.yaml`.

    You can optionally secure this cluster with authentication and SSL. See [Advanced configuration](https://docs.newrelic.com/docs/opentelemetry/integrations/elasticsearch/advanced-configuration#secured).

### Configuration parameters [#configuration-parameters]

The following table describes the key configuration parameters used in the `deployment-configmap.yaml` above:

| Parameter                                                                          | Description                                                                                                                                                            |
| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `rule`                                                                             | The pod-matching rule used for auto-discovery. Update `labels["app"] == "elasticsearch"` to match your pod labels.                                                     |
| `endpoint`                                                                         | The Elasticsearch endpoint scraped on each discovered pod. Update port `9200` if Elasticsearch runs on a different port, and use `https` for a secured cluster.        |
| `collection_interval`                                                              | The interval between metric scrapes. The default is 15s.                                                                                                               |
| `elasticsearch-cluster` (in `resource/cluster` / `resource/cluster_name_override`) | A unique name identifying this cluster in New Relic. Replace with a name that's unique across your account.                                                            |
| `NEW_RELIC_MEMORY_LIMIT_MIB`                                                       | The memory limit, in MiB, for the collector's `memory_limiter` processor. Set to fit your environment.                                                                 |
| `NEWRELIC_LICENSE_KEY`                                                             | Your New Relic [license key](https://docs.newrelic.com/docs/apis/intro-apis/new-relic-api-keys/#ingest-license-key).                                                   |
| `NEWRELIC_OTLP_ENDPOINT`                                                           | The New Relic OTLP endpoint for your account's region. See [New Relic OTLP endpoints](https://docs.newrelic.com/docs/opentelemetry/best-practices/opentelemetry-otlp). |

## Install and configure the NRDOT collector via kubectl [#install-manifest]

Apply the updated manifests to deploy the NRDOT collector to your cluster with the image and settings you just prepared.

```bash
kubectl apply -n newrelic -R -f rendered
```

## Restart the NRDOT collector pods [#restart]

Restart the deployment to apply your changes:

```bash
kubectl rollout restart deployment nr-k8s-otel-collector-deployment -n newrelic
```

## Verify your install [#verify]

Within ~5 minutes of installing, run this query in New Relic to confirm data is flowing (replace `elasticsearch-cluster` with your cluster's name):

```sql
FROM Metric
SELECT *
WHERE metricName LIKE 'elasticsearch.%'
  AND instrumentation.provider = 'opentelemetry'
  AND k8s.cluster.name = 'elasticsearch-cluster'
SINCE 10 minutes ago
```

> #### 💡 TIP
>
> You can also check the collector itself: the pod should be in a `Running` state (`kubectl get pods -n newrelic --watch`), name like `nr-k8s-otel-collector-deployment-<hash>`, with no connection errors in the pod logs (`kubectl logs -n newrelic -l app.kubernetes.io/name=nr-k8s-otel-collector -f`).

If you don't see data within ~5 minutes, see [Kubernetes troubleshooting](https://docs.newrelic.com/docs/opentelemetry/integrations/elasticsearch/troubleshooting#kubernetes-troubleshooting).

## Find and use your data [#find-and-use]

Once New Relic collects your data, you can access Elasticsearch monitoring through the New Relic UI.

To find your Elasticsearch dashboard in New Relic:

1.  Go to **one.newrelic.com > Integrations & Agents**.
2.  Under the **All** tab, click **Dashboards**, then search for **Elasticsearch (OpenTelemetry Collector)** to view the dashboard.

Or, from the left navigation:

1.  Click **Dashboards**.
2.  Search for the **Elasticsearch (OpenTelemetry Collector)** dashboard to view it.

After setting up Elasticsearch monitoring with NRDOT, you can:

-   [Create custom dashboards](https://docs.newrelic.com/docs/query-your-data/explore-query-data/dashboards/introduction-dashboards/) to visualize your Elasticsearch metrics
-   [Set up alerts](https://docs.newrelic.com/docs/alerts/create-alert/create-alert-condition/alert-conditions/) for critical cluster health and performance thresholds
-   [Explore your data](https://docs.newrelic.com/docs/query-your-data/explore-query-data/browse-data/introduction-data-explorer/) using New Relic query capabilities

> #### 💡 TIP
>
> **Correlate APM with Elasticsearch**: To connect your APM application and Elasticsearch cluster, include the resource attribute `es.cluster.name="your-cluster-name"` in your APM metrics. This lets you view APM and Elasticsearch data together in New Relic.

## Related articles [#related-articles]

-   [Advanced configuration](https://docs.newrelic.com/docs/opentelemetry/integrations/elasticsearch/advanced-configuration)
-   [Correlate APM with Elasticsearch using distributed tracing](https://docs.newrelic.com/docs/opentelemetry/integrations/elasticsearch/distributed-tracing)
-   [Elasticsearch metrics reference](https://docs.newrelic.com/docs/opentelemetry/integrations/elasticsearch/metrics-reference)
-   [Elasticsearch troubleshooting](https://docs.newrelic.com/docs/opentelemetry/integrations/elasticsearch/troubleshooting)
