Hello!
I've recently set up a Raspi 4B cluster (4 nodes) and deployed PiHole aaS. While doing that I ran into a few problems. I currently have a hacky solution running successfully but who knows for how long it will work.
The problem
version: "3"
services:
pihole:
container_name: pihole
image: pihole/pihole:latest
deploy:
mode: replicated
replicas: 1
placement:
constraints: [node.role == manager]
volumes:
- "/home/ubuntu/docker/pihole/etc-pihole/:/etc/pihole/"
- "/home/ubuntu/docker/pihole/etc-dnsmasq.d/:/etc/dnsmasq.d/"
ports:
- 53:53/tcp
- 53:53/udp
restart: unless-stopped
dns:
- 127.0.0.1
- 84.200.69.80
environment:
- "TZ=Austria/Vienna"
- "WEBPASSWORD=<redacted>"
labels:
- "traefik.enable=true"
- "traefik.http.routers.pihole.entrypoints=web"
- "traefik.http.routers.pihole.rule=Host(`pihole.backbone.localdomain`)"
- "traefik.http.services.pihole-svc.loadbalancer.server.port=80"
- "traefik.http.routers.pihole.service=pihole-svc"
networks:
- traefik-backend
- bridge
networks:
traefik-backend:
external:
name: traefik-backend
bridge: #hacky workaround to make PiHole not publishing DNS to the overlay net
As you can see it's pretty much a standard PiHole docker-compose.yml with a few differences:
- deployment with only 1 replica on the master node (because hell why not?)
- a load of labels for Traefik
- 2 networks
The relevant part here are the networks. traefik-backend
was a bridge connecting every container that had a web frontend to Traefik. I changed it for swarming to an overlay network (hell yeah I want to move services to other hosts but should still be able to proxy them) And that's where problems started to arise.
PiHole is configured to expose dnsmasq
to eth0
which it did successfully so far but when I restarted the container none of my DNS requests could be resolved anymore. I suspect it's due to the new network type. PiHole opened to the traefik-backend
and I couldn't do a single DNS request anymore even given that the ports were forwarded to the host.
Fun fact: the web interface was available and reachable all the time during my doings. Before. While only traefik-backend
and ingress
was available and after I applied my "solution".
The hacky solution
My solution to this was to add the bridge
net. It brought itself before the traefik-backend
and became eth0
. I can now resolve hosts again.
Debug token
My question
I haven't come up with the real question yet. I want to know why I PiHole can't resolve DNS requests when connected to an overlay network. I mean I can open the dashboard, so I should also be able to communicate with the DNS server right?