---
title: CoreDNS integration
source: https://docs.newrelic.com/docs/infrastructure/prometheus-integrations/integrations-list/core-dns-integration
---

[CoreDNS](https://coredns.io/) is a DNS server and forwarder written in Go that chains plugins. Each plugin performs a DNS function.

Use New Relic for visualizing CoreDNS performance, alerting on potential errors, and troubleshooting in an error scenario. CoreDNS is a critical Kubernetes cluster component. With New Relic you can monitor:

-   Your system health
-   CoreDNS latency
-   CoreDNS errors
-   Cache stats

![CoreDNS Dashboard](https://docs.newrelic.com/images/kubernetes_screenshot-crop_coredns-dashboard.webp "CoreDNS Dashboard")

## Enable the integration

Follow these steps to enable the integration.

1.  Follow the [CoreDNS documentation](https://coredns.io/plugins/kubernetes/#metrics) for Prometheus to discover the CoreDNS metrics endpoints.

2.  Set up Prometheus monitoring. Prometheus metrics needs to be integrated with New Relic, you can use the Prometheus Agent or the Remote Write integration, see [how to send Prometheus metrics](https://docs.newrelic.com/docs/infrastructure/prometheus-integrations/get-started/send-prometheus-metric-data-new-relic/).

    > #### ⚠️ IMPORTANT
    >
    > The [Prometheus Agent](https://docs.newrelic.com/docs/infrastructure/prometheus-integrations/install-configure-prometheus-agent/setup-prometheus-agent#scrape-metrics-only-from-prometheus-integrations-scrape-prometheus-integrations) only scrapes metrics by default from a [set of integrations](https://docs.newrelic.com/docs/infrastructure/prometheus-integrations/integrations-list/integrations-list-intro).
    >
    > In this case, you must identify your pod or endpoint with one of the these labels `app.kubernetes.io/name`, `app.newrelic.io/name`, `k8s-app` containing the string `coredns` or `kube-dns`.

3.  Use the following query to confirm metrics are being ingested as expected:

    ```sql
    FROM Metric SELECT count(*) WHERE metricName LIKE 'coredns_%' FACET metricName LIMIT MAX
    ```

4.  Install the [CoreDNS quickstart](https://newrelic.com/instant-observability/CoreDNS) to access built-in dashboards and [alerts](https://docs.newrelic.com/docs/alerts-applied-intelligence/new-relic-alerts/learn-alerts/introduction-alerts/).

    Once you imported, you can edit or clone the assets to adapt them to your specific requirements.

    > #### ⚠️ IMPORTANT
    >
    > Some charts of the dashboard include queries with conditions that require the identification of your pod or endpoint with one of the these labels `app.kubernetes.io/name`, `app.newrelic.io/name`, `k8s-app` containing the string `coredns` or `kube-dns`.

## Find and use the data

### Metrics

Prometheus metrics are stored as dimensional metrics. You can [query using NRQL](https://docs.newrelic.com/docs/telemetry-data-platform/get-data/apis/query-metric-data-type/) or use the [Data Explorer](https://docs.newrelic.com/docs/query-your-data/explore-query-data/browse-data/introduction-data-explorer/) to browse the available metrics, facet, and filter by the associated dimensions.

The different sets of metrics exposed by this integration are defined in the [CoreDNS documentation](https://coredns.io/plugins/metrics/).

Use the following NRQL queries to understand the metrics being ingested in New Relic:

-   List unique metric names:

    ```sql
    FROM Metric SELECT uniques(metricName) WHERE metricName LIKE 'coredns_%' LIMIT MAX
    ```

-   Count number of metric updates:

    ```sql
    FROM Metric SELECT datapointcount() WHERE metricName LIKE 'coredns_%' LIMIT MAX
    ```

-   Estimate data ingestion (daily ingest, in bytes):

    ```sql
    FROM Metric SELECT bytecountestimate() WHERE metricName LIKE 'coredns_%' SINCE 1 day ago
    ```

## Troubleshooting

Follow the troubleshooting tips from [CoreDNS documentation](https://coredns.io/plugins/kubernetes/) to make sure that metrics are configured as expected on your cluster.

You can also check the specific [troubleshooting guidelines](https://docs.newrelic.com/docs/infrastructure/prometheus-integrations/troubleshooting/no-data-appears-prometheus-integration) for Prometheus integrations.
