Kubernetes Deployment Guide
This guide explains how to deploy DNS-collector onto a Kubernetes cluster.
Quick Start
Download the provided dnscollector-deployment.yml manifest and apply it to your cluster:
kubectl apply -f https://raw.githubusercontent.com/dmachard/DNS-collector/main/dnscollector-deployment.yml
Or apply it locally if you cloned the repository:
Verify that the pod and service are running:
Check the DNS-collector logs:
What is Deployed
The dnscollector-deployment.yml manifest defines three core Kubernetes resources:
ConfigMap(dnscollector-config): Contains the DNS-collector YAML configuration (/etc/dnscollector/config.yml).Service(dnscollector-service): Exposes:- Port
6000/TCP: Ingestion port for DNStap collectors. - Port
8080/TCP: Prometheus metrics endpoint. Deployment(dnscollector-deployment): Runs thedmachard/dnscollector:latestcontainer with:- Mounted configuration from the ConfigMap.
- Liveness & Readiness TCP socket probes.
- Configured resource requests and limits.
Customizing Configuration
You can customize the pipeline (add collectors, transformers, or loggers) directly in the ConfigMap section of dnscollector-deployment.yml:
apiVersion: v1
kind: ConfigMap
metadata:
name: dnscollector-config
labels:
app: dnscollector
data:
config.yml: |
global:
trace:
verbose: true
multiplexer:
collectors:
- name: tap
dnstap:
listen-ip: 0.0.0.0
listen-port: 6000
transforms:
normalize:
qname-lowercase: true
loggers:
- name: console
stdout:
mode: text
- name: prom
prometheus:
listen-ip: 0.0.0.0
listen-port: 8080
routes:
- from: [ tap ]
to: [ console, prom ]
Apply your updated manifest and trigger a rollout:
kubectl apply -f dnscollector-deployment.yml
kubectl rollout restart deployment/dnscollector-deployment
Connecting DNS Servers (DNStap)
Within your Kubernetes cluster, configure your DNS servers (CoreDNS, Bind9, Unbound, PowerDNS) to stream DNStap logs to:
Example with Bind9 in Kubernetes:
Scraping Prometheus Metrics
To enable automatic scraping by Prometheus Operator or Prometheus server, add standard annotations to the Deployment template:
spec:
template:
metadata:
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "8080"
prometheus.io/path: "/metrics"
To test metrics locally with port-forwarding:
Local Testing with MicroK8s or Minikube
If you do not have a running cluster, you can use MicroK8s or Minikube: