dns-exporter

by christianhuth

Helm chartv2.6.2App 1.2.3Verified publisher

A multi-target Prometheus exporter with an exclusive focus on DNS monitoring

About this chart

dns-exporter

A multi-target Prometheus exporter with an exclusive focus on DNS monitoring

TL;DR;

helm repo add christianhuth https://charts.christianhuth.de
helm repo update
helm install my-release christianhuth/dns-exporter

Or install it from the OCI registry:

helm install my-release oci://ghcr.io/christianhuth/helm-charts/dns-exporter

Introduction

This chart bootstraps the Prometheus DNS-Exporter using the Helm package manager.

Prerequisites

  • Kubernetes 1.19+

Installing the Chart

To install the chart with the release name my-release:

helm repo add christianhuth https://charts.christianhuth.de
helm repo update
helm install my-release christianhuth/dns-exporter

The chart is also published as an OCI artifact which can be installed like this:

helm install my-release oci://ghcr.io/christianhuth/helm-charts/dns-exporter

These commands deploy the DNS-Exporter on the Kubernetes cluster in the default configuration. The Values section lists the values that can be configured during installation.

Tip: List all releases using helm list

Defining Scrape Targets

This Helm Charts allows you to create two ServiceMonitors:

  • One for the metrics of the DNS-Exporter itself
  • One for the DNS metrics of the targets

The Scrape Targets can be configured using .serviceMonitor.targetsMonitor.targets. For each Scrape Target we need to define at least the DNS server and ip family (ipv4 or ipv6). You also have to define the family if you are scraping DNS records unrelated to the ip address type like NS.

A basic example would look like this:

serviceMonitor:
  targetsMonitor:
    targets:
      - query_name:
          - christianhuth.de
        family:
          - ipv4
        server:
          - dns.google

While this looks like you can define multiple values for the attributes, this is sadly not supported by the DNS-Exporter. Defining multiple values will result in only the first value taking affect.

There are more attributes you can define for each target. A complete list can be found [https://dns-exporter.readthedocs.io/latest/configuration.html#settings](in the official documentation).

Instead of defining all the attributes (like family, server, ...) for each target again, you can use pre-defined modules or define your own ones using .Values.modulesConfig.

modulesConfig:
  google_udp:
    family: ipv4
    protocol: udp
    server: dns.google
    query_type: NS

serviceMonitor:
  targetsMonitor:
    targets:
      - query_name:
          - christianhuth.de
        module:
          - google_udp

This will result in a query for the NS records of christianhuth.de using the DNS server dns.google with the UDP protocol. In this example, the ip family is only defined, because DNS-Exporter won't work without defining one.

Uninstalling the Chart

To uninstall the my-release deployment:

helm uninstall my-release

The command removes all the Kubernetes components associated with the chart and deletes the release.

Values

KeyTypeDefaultDescription
affinityobject{}Affinity settings for pod assignment
autoscaling.enabledboolfalse
autoscaling.maxReplicasint100
autoscaling.minReplicasint1
autoscaling.targetCPUUtilizationPercentageint80
containerPortint15353Defines port the container and exporter is listening on
deploymentStrategyobject{}Update strategy for the deployment
extraArgslist[]Additional command arguments that will be passed to the exporter
extraEnvlist[]Additional environment variables that will be added to the deployment
fullnameOverridestring""String to fully override "netcupscp-exporter.fullname"
image.pullPolicystring"Always"image pull policy
image.registrystring"docker.io"image registry
image.repositorystring"tykling/dns_exporter"image repository
image.tagstring"1.2.3"Overrides the image tag
imagePullSecretslist[]If defined, uses a Secret to pull an image from a private Docker registry or repository.
ingress.annotationsobject{}
ingress.classNamestring""
ingress.enabledboolfalse
ingress.hosts[0].hoststring"chart-example.local"
ingress.hosts[0].paths[0].pathstring"/"
ingress.hosts[0].paths[0].pathTypestring"ImplementationSpecific"
ingress.tlslist[]
modulesConfigobject{}Define modules that can be used inside your targets
nameOverridestring""Provide a name in place of netcupscp-exporter
nodeSelectorobject{}Node labels for pod assignment
podAnnotationsobject{}Annotations to be added to pods
podMonitor.enabledboolfalseEnable a prometheus PodMonitor CR
podMonitor.selfMonitor.additionalLabelsobject{}Prometheus PodMonitor labels
podMonitor.selfMonitor.enabledbooltrueEnable a prometheus PodMonitor to monitor the DNS Exporter
podMonitor.selfMonitor.intervalstring"30s"Prometheus PodMonitor interval
podMonitor.selfMonitor.metricRelabelingslist[]Prometheus [MetricRelabelConfigs] to apply to samples before ingestion
podMonitor.selfMonitor.namespacestring""Prometheus PodMonitor namespace
podMonitor.selfMonitor.scrapeTimeoutstring""Prometheus PodMonitor scrapeTimeout, cannot be longer than the scrape interval
podMonitor.selfMonitor.selectorobject{}Prometheus PodMonitor selector
podMonitor.targetsMonitor.additionalLabelsobject{}Prometheus PodMonitor labels
podMonitor.targetsMonitor.enabledbooltrueEnable a prometheus PodMonitor to monitor the Targets of the DNS Exporter
podMonitor.targetsMonitor.intervalstring"30s"Prometheus PodMonitor interval
podMonitor.targetsMonitor.metricRelabelingslist[]Prometheus [MetricRelabelConfigs] to apply to samples before ingestion
podMonitor.targetsMonitor.namespacestring""Prometheus PodMonitor namespace
podMonitor.targetsMonitor.scrapeTimeoutstring""Prometheus PodMonitor scrapeTimeout, cannot be longer than the scrape interval
podMonitor.targetsMonitor.selectorobject{}Prometheus PodMonitor selector
podMonitor.targetsMonitor.targetslist[]Targets that should be scraped by the DNS-Exporter
podMonitor.typestring"prometheus"Which api version for the podmonitor should be used. Valid values are google and prometheus
podSecurityContextobject{}pod-level security context
priorityClassNamestring""Priority class name ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/#priorityclass
replicaCountint1Number of replicas
resourcesobject{}Resource limits and requests for the headwind pods.
revisionHistoryLimitint0The number of old ReplicaSets to retain
route.main.additionalRuleslist[]Additional custom rules that can be added to the route
route.main.annotationsobject{}Add annotations to the route
route.main.apiVersionstring"gateway.networking.k8s.io/v1"Set the route apiVersion, e.g. gateway.networking.k8s.io/v1 or gateway.networking.k8s.io/v1alpha2
route.main.enabledboolfalseEnables or disables the route
route.main.filterslist[]Filters define the filters that are applied to requests that match this rule.
route.main.hostnameslist[]Hostnames to be matched
route.main.httpsRedirectboolfalseadds a filter for redirecting to https (HTTP 301 Moved Permanently). To redirect HTTP traffic to HTTPS, you need to have a Gateway with both HTTP and HTTPS listeners. Matches and filters do not take effect if enabled. Ref. https://gateway-api.sigs.k8s.io/guides/http-redirect-rewrite/
route.main.kindstring"HTTPRoute"Set the route kind Valid options are GRPCRoute, HTTPRoute, TCPRoute, TLSRoute, UDPRoute
route.main.labelsobject{}Add labels to the route
route.main.matcheslistsee values.yamldefine conditions used for matching the rule against incoming HTTP requests.
route.main.parentRefslist[]Parent references (Gateway)
route.main.timeoutsobject{}defines the timeouts that can be configured for an HTTP request
securityContextobject{}container-level security context
service.portint80Kubernetes port where service is exposed
service.typestring"ClusterIP"Kubernetes service type
serviceAccount.annotationsobject{}Annotations to add to the service account
serviceAccount.createbooltrueSpecifies whether a service account should be created
serviceAccount.namestring""The name of the service account to use. If not set and create is true, a name is generated using the fullname template
serviceMonitor.enabledboolfalseEnable a prometheus ServiceMonitor
serviceMonitor.selfMonitor.additionalLabelsobject{}Prometheus ServiceMonitor labels
serviceMonitor.selfMonitor.enabledbooltrueEnable a prometheus ServiceMonitor to monitor the DNS Exporter
serviceMonitor.selfMonitor.intervalstring"30s"Prometheus ServiceMonitor interval
serviceMonitor.selfMonitor.metricRelabelingslist[]Prometheus [MetricRelabelConfigs] to apply to samples before ingestion
serviceMonitor.selfMonitor.namespacestring""Prometheus ServiceMonitor namespace
serviceMonitor.selfMonitor.relabelingslist[]Prometheus [RelabelConfigs] to apply to samples before scraping
serviceMonitor.selfMonitor.scrapeTimeoutstring""Prometheus ServiceMonitor scrapeTimeout, cannot be longer than the scrape interval
serviceMonitor.selfMonitor.selectorobject{}Prometheus ServiceMonitor selector
serviceMonitor.targetsMonitor.additionalLabelsobject{}Prometheus ServiceMonitor labels
serviceMonitor.targetsMonitor.enabledbooltrueEnable a prometheus ServiceMonitor to monitor the Targets of the DNS Exporter
serviceMonitor.targetsMonitor.intervalstring"30s"Prometheus ServiceMonitor interval
serviceMonitor.targetsMonitor.metricRelabelingslist[]Prometheus [MetricRelabelConfigs] to apply to samples before ingestion
serviceMonitor.targetsMonitor.namespacestring""Prometheus ServiceMonitor namespace
serviceMonitor.targetsMonitor.relabelingslist[]Prometheus [RelabelConfigs] to apply to samples before scraping
serviceMonitor.targetsMonitor.scrapeTimeoutstring""Prometheus ServiceMonitor scrapeTimeout, cannot be longer than the scrape interval
serviceMonitor.targetsMonitor.selectorobject{}Prometheus ServiceMonitor selector
serviceMonitor.targetsMonitor.targetslist[]Targets that should be scraped by the DNS-Exporter
tolerationslist[]Toleration labels for pod assignment

Specify each parameter using the --set key=value[,key=value] argument to helm install.

Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,

helm install my-release -f values.yaml christianhuth/dns-exporter

Deploy dns-exporter with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has dns-exporter on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartdns-exporter is pinned at v2.6.2 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply