I am running Traefik on a simple single-node docker host. I had a successful configuration in the past with port-forwarding, but decided to let Traefik run with host network mode to get useful source IP addresses, for example for fail2ban.
Problem is: After switching Traefik to host network, i cannot access its dashboard and API, and am struggling to find out why.
Currently i have this in my compose file for traefik itself:
labels:
traefik.enable: "true"
traefik.http.routers.api.rule: "Host(`traefik.{{ traefik_domain }}`)"
traefik.http.routers.api.entrypoints: "https"
traefik.http.routers.api.middlewares: "auth@file"
traefik.http.routers.api.service: "api@internal"
traefik.http.routers.api.tls.certresolver: "le"
This is a snippet from my traefik.yaml:
entryPoints:
http:
address: ":80"
https:
address: ":443"
traefik:
address: ":8082"
The dashboard is currently accessible via http://hostip:8082, but i want traefik to have a route to itself, for middlewares, TLS handling and so on.
I have some other services on the same host with host networking, which have a similar config in their compose files, which are still accessible, so i'm wondering why the API behaves differently.
What is working, however, is to not define the service as api@internal
but with the following settings:
traefik.http.routers.api.rule: "Host(`traefik.{{ traefik_domain }}`)"
traefik.http.routers.api.entrypoints: "https"
traefik.http.routers.api.middlewares: "auth@file"
traefik.http.routers.api.service: "api"
traefik.http.routers.api.tls.certresolver: "le"
traefik.http.services.api.loadbalancer.server.port: "8082"
So not letting traefik access itself internally but accessing the host network address on port 8082 which is the entrypoint for the API. Why is it like that, that its not possible to access traefik internally when its running in host network mode?