docker-traefik icon indicating copy to clipboard operation
docker-traefik copied to clipboard

Pihole (on a remote host)

Open fabricesemti80 opened this issue 4 years ago • 0 comments

Hi There!

Great guide, thanks for the effort!

I have one problem though.

I try to forward some services (for starters I am trying to do this with PiHole) to another (k8s) server on my network, but I am struggling to make this work.

My Docker server runs on 192.168.0.21, the k8s hosts are on 192.168.0.11 - .13, and the loadbalancer range for k8s is 192.168.0.240 - .250. PiHole is on 192.168.0.242, and it is accessible within my network.

I have this configuration in the the docker compose:

`...

Cloudflare-Companion - Automatic CNAME DNS Creation

cf-companion: container_name: cf-companion image: tiredofit/traefik-cloudflare-companion:latest # security_opt: # - no-new-privileges:true restart: unless-stopped networks: - socket_proxy #depends_on: # - socket-proxy environment: - TIMEZONE=$TZ - TRAEFIK_VERSION=2 #- CF_EMAIL=$CLOUDFLARE_EMAIL - CF_TOKEN=$CLOUDFLARE_API_TOKEN - TARGET_DOMAIN=$DOMAINNAME0 - DOMAIN1=$DOMAINNAME0 - DOMAIN1_ZONE_ID=$CLOUDFLARE_ZONEID # Copy from Cloudflare Overview page - DOMAIN1_PROXIED=TRUE - DOCKER_HOST=tcp://socket-proxy:2375 secrets: # not working - cloudflare_api_token labels: # Add hosts specified in rules here to force cf-companion to create the CNAMEs # Since cf-companion creates CNAMEs based on host rules, this a workaround for non-docker/external apps # - "traefik.http.routers.cf-companion-rtr.rule=Host(mox.$DOMAINNAME0) || Host(pwt.$DOMAINNAME0) || Host(webmin.$DOMAINNAME0) || Host(shell.$DOMAINNAME0)" - "traefik.http.routers.cf-companion-rtr.rule=Host(plex.$DOMAINNAME0) || Host(pihole.$DOMAINNAME0)" `

 (plex router does not work either, but for now I am focusing on PiHole)
 
 the app-pihole.toml rule is set as this:

[http.routers] [http.routers.pihole-rtr] entryPoints = ["https"] middlewares = ["chain-authelia", "pihole-add-admin"] rule = "HostHeader(pihole.<mydomain.com>`)" service = "pihole-svc" [http.routers.pihole-rtr.tls] certresolver = "dns-cloudflare"

[http.middlewares] [http.middlewares.pihole-add-admin.addPrefix] prefix = "/admin"

[http.services] [http.services.pihole-svc] [http.services.pihole-svc.loadBalancer] passHostHeader = true [[http.services.pihole-svc.loadBalancer.servers]] url = "http://192.168.0.242:80" # or whatever your external host's IP:port is`

I can confirm the pihole.<mydomain.com> DNS entry gets created, but when I would browse to that address, I get HTTP error 500...

Any chance you can advise what am I missing?

Thanks, Fabrice

fabricesemti80 avatar May 11 '21 17:05 fabricesemti80