Hello,
I'm trying to get my Pihole working with DHCP and DNS inside a Kubernetes cluster. My router doesn't have settings for setting a DNS server, so I've always relied on this setup. I've had success running it in Docker container so I know it's possible.
In my current setup, the DHCP server is accepting DHCP requests and sending back DHCP offers for IP's. I can even see the IP's leases in the PiHole server, so I believe it's working. The problem is that any device that gets this IP isn't talking to the PiHole DNS server. In the admin dashboard, I don't see any queries to the Pihole instance.
I tried to run nslookup pi.hole
on my local machine that was given an IP by the Pihole DHCP server, but I don't get any results due to timeout. However, if I query the Pihole DNS server directly using dig @192.168.1.201 pi.hole
, then I get the correct address for the server 192.168.201
.
Setup:
- Pihole in Kubernetes Cluster
- Pihole container is
privileged
, onhostNetwork
, and hasNET_ADMIN
capabilities - Pihole DHCP server is enabled
- Pihole DHCP server and DNS server are both running on
192.168.1.201
-
192.168.1.201
is a virtual IP that's provided by the cluster load balancer. - No other DHCP servers on the network (disabled on router)
- I have one file mounted which is
/etc/dnsmasq.d/01-dhcp-options.conf
. It contains the static IP address for the Pi-hole DNS server:dhcp-option=option:dns-server,192.168.1.201
. - Pihole is fully stateless. No persistent storage mounted.
Assumptions:
- DHCP is working: All my devices are getting their IP from the Pihole instance. I can see the leases in the Pihole admin dashboard.
-
DNS is working: Can query the DNS server directly for domain name resolution, e.g.
dig @192.168.1.201 pi.hole
Expected Behavior
When a device is given an IP from the Pihole DHCP server, it should use the Pihole DNS server for domain name resolution. The side effect of this is that ads are blocked on the machine and nslookup pi.hole
queries the PiHole DNS server to resolve the domain.
Actual Behavior
When a device is given an IP from the Pihole DHCP, it doesn't use the Pihole's DNS server. I'm not really sure how to further debug this or what the issue could be.
At first, I thought adding the /etc/dnsmasq.d/01-dhcp-options.conf
config with dhcp-option=option:dns-server,192.168.1.201
would work, but I'm still running into the same issue.
A moonshot thought was maybe it could be an issue with IPv6 since I don't really know how any of that works. I don't know if my devices are even using IPv6 but they are all Apple devices.
I do see some queries in the Pihole dashboard, however, they are all for debug.opendns.com
. Haven't seen queries for any of the websites that I've been visiting on my machine.