In my homelab, I wanted a reliable, self-hosted DNS solution that integrates directly with Kubernetes.
Bind9 provides the stability and flexibility I need, while Terraform automates DNS record management, making deployments seamless.
This guide walks through deploying Bind9 on Kubernetes, storing configs on TrueNAS, and automating DNS with Terraform.
Running Bind9 inside Kubernetes allows:
In my setup, Bind9 handles:
Store your named.conf and zone files in NFS share on TrueNAS:
/nfs/bind9/
├── named.conf
├── named.conf.options
└── zones/
└── home.isujith.dev.db
Create TLS and TSIG secrets:
kubectl create secret generic bind-tls \
--from-file=tls.crt=cert.pem \
--from-file=tls.key=key.pem
kubectl create secret generic bind-tsig \
--from-literal=key="YOUR_TSIG_KEY"
Deployment Manifest
apiVersion: apps/v1
kind: Deployment
metadata:
name: bind9
spec:
replicas: 1
selector:
matchLabels:
app: bind9
template:
metadata:
labels:
app: bind9
spec:
containers:
- name: bind9
image: internetsystemsconsortium/bind9:9.18
ports:
- containerPort: 53
protocol: UDP
- containerPort: 53
protocol: TCP
- containerPort: 853
- containerPort: 443
volumeMounts:
- name: bind-config
mountPath: /etc/bind
- name: tls-secret
mountPath: /etc/bind/tls
readOnly: true
volumes:
- name: bind-config
persistentVolumeClaim:
claimName: bind9-pvc
- name: tls-secret
secret:
secretName: bind-tls