Skip to content

CoreDNS

Prometheus Metrics

CoreDNS is a flexible, plugin-based DNS server commonly used as the default DNS provider in Kubernetes clusters.

CoreDNS exposes Prometheus metrics through the prometheus plugin. Add it to your Corefile:

. {
prometheus :9153
forward . 8.8.8.8
cache 30
log
}

In many deployments (including Kubernetes), the prometheus plugin is already enabled by default on port 9153. Metrics are available at http://localhost:9153/metrics.

Terminal window
sudo tee /etc/glouton/conf.d/99-coredns.conf > /dev/null << 'EOF'
metric:
prometheus:
targets:
- url: "http://localhost:9153/metrics"
name: "coredns"
allow_metrics:
- "coredns_dns_requests_total"
- "coredns_dns_responses_total"
- "coredns_dns_request_duration_seconds*"
- "coredns_cache_hits_total"
- "coredns_cache_misses_total"
EOF

Glouton automatically detects configuration changes.

Metric Description
coredns_dns_requests_total Total number of DNS requests received
coredns_dns_responses_total Total number of DNS responses sent
coredns_dns_request_duration_seconds Histogram of DNS request processing durations in seconds
coredns_cache_hits_total Total number of cache hits
coredns_cache_misses_total Total number of cache misses