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

This guide shows how to deploy NRDOT on Kubernetes using Helm 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
-   Helm 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
-   Helm 3.x installed
-   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 credentials and collector settings [#prepare]

Create the credentials the collector needs, then define its Elasticsearch monitoring configuration in a `values.yaml` file. You install the collector with this configuration in the next step.

1.  Create the namespace and a secret for your New Relic credentials:

    ```bash
    kubectl create namespace newrelic
    kubectl create secret generic newrelic-licenses \
      --from-literal=NEWRELIC_LICENSE_KEY=YOUR_LICENSE_KEY_HERE \
      --from-literal=NEWRELIC_OTLP_ENDPOINT=YOUR_NEWRELIC_OTLP_ENDPOINT \
      --from-literal=NEW_RELIC_MEMORY_LIMIT_MIB=100 \
      -n newrelic
    ```

    Replace the memory limit with what fits your environment.

2.  Create a `values.yaml` file for the NRDOT collector: set `rule` to match your pod label, and set `K8S_CLUSTER_NAME` to a unique name for this cluster:

    ```yaml
    mode: deployment

    image:
      repository: newrelic/nrdot-collector
      tag: latest
      pullPolicy: IfNotPresent

    resources:
      limits:
        cpu: 500m
        memory: 512Mi
      requests:
        cpu: 200m
        memory: 256Mi

    ports: {}

    extraEnvs:
      - name: NEWRELIC_LICENSE_KEY
        valueFrom:
          secretKeyRef:
            name: newrelic-licenses
            key: NEWRELIC_LICENSE_KEY
      - name: NEWRELIC_OTLP_ENDPOINT
        valueFrom:
          secretKeyRef:
            name: newrelic-licenses
            key: NEWRELIC_OTLP_ENDPOINT
      - name: NEW_RELIC_MEMORY_LIMIT_MIB
        valueFrom:
          secretKeyRef:
            name: newrelic-licenses
            key: NEW_RELIC_MEMORY_LIMIT_MIB
      - name: K8S_CLUSTER_NAME
        value: "elasticsearch-cluster"

    clusterRole:
      create: true
      rules:
        - apiGroups: [""]
          resources: ["pods", "nodes", "nodes/stats", "nodes/proxy"]
          verbs: ["get", "list", "watch"]
        - apiGroups: ["apps"]
          resources: ["replicasets"]
          verbs: ["get", "list", "watch"]

    config:
      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: "${env:K8S_CLUSTER_NAME}"
              action: insert
        resource/cluster_name_override:
          attributes:
            - key: elasticsearch.cluster.name
              value: "${env:K8S_CLUSTER_NAME}"
              action: upsert
        resourcedetection:
          detectors: [env, system]
          system:
            resource_attributes:
              host.name:
                enabled: true
              host.id:
                enabled: true
              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]
    ```

    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 `values.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 `K8S_CLUSTER_NAME`) | 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 Helm [#install-helm]

Deploy the NRDOT collector to your cluster. Helm applies the configuration from the `values.yaml` file you just created.

1.  Add and update the OpenTelemetry Helm chart repository:

    ```bash
    helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts
    helm repo update
    ```

2.  Deploy the NRDOT collector:

    ```bash
    helm upgrade --install elasticsearch-nrdot-collector open-telemetry/opentelemetry-collector \
      --namespace newrelic \
      --create-namespace \
      -f values.yaml
    ```

## 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 `elasticsearch-nrdot-collector-<hash>`, with no connection errors in the pod logs (`kubectl logs -n newrelic -l app.kubernetes.io/name=opentelemetry-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)
