Ever since I’ve started running a home-lab, one service that has been a staple for me is Pi-hole. It’s fast, reliable and low foot print DNS server that also blocks adds.
More information about Pi-hole here: https://pi-hole.net/
I’ve tried different iteration of installation: from linux install to my current setup, running as a container in a stand-alone docker host. Now, I’ve started switching all my apps to Kubernetes and it’s time to move Pi-hole.
Multiple guides are available on how to do this but there’s no single resource on the specific requirement I wanted:
- Pi-hole as stateless pod – so I can easily scale the application by increasing the replica
- Metrics exposed – because we will not be using the admin page, the metrics needs to be exposed for prometheus + grafana usage.
What I end-up doing is combine the pi-hole exporter and run it as a side-car to the pi-hole container. The pi-hole service is exposed thru metallb with externalPolicy: Local to make sure client-ips are reflected to the pods.
Github source here: https://github.com/dmnt3d/Kubernetes-Pihole-with-Exporter/
Here’s a screenshot of the modified grafana dashboard to accommodate pod replica numbers.