"field not found, node: loadbalancer" attempting to set port

Hey, first time user trying to set up a simple port 80 reverse proxy to start with, but I’m in a pickle.

I have this traefik configuration:

  9   traefik:
 10     image: traefik:latest
 11     container_name: traefik
 12     command:
 13       #- "--log.level=DEBUG"
 14       - "--api.insecure=true"
 15       - "--providers.docker=true"
 16       - "--providers.docker.exposedbydefault=false"
 17       - "--entryPoints.web.address=:80"
 18     ports:
 19       - "80:80"
 20       - "443:443"
 21       - "8080:8080"
 22     volumes:
 23       - "/var/run/docker.sock:/var/run/docker.sock:ro"

And these are the labels on my pihole service:

 52       - traefik.enable=true
 53       - traefik.http.routers.pihole.rule=Host(`pihole.MYDOMAIN.XYZ`)
 54       - traefik.http.routers.pihole.entrypoints=web
 55       - traefik.http.routers.pihole.loadbalancer.server.port=9080

I’m setting it to port 9080 as that’s what I have the internal port 80 on the service routing to. When I don’t include the …server.port= line requests to pihole.MYDOMAIN.XYZ eventually timeout with a bad gateway, logs indicate it’s routing to port 53 (also being served by the container):

 DBG github.com/traefik/traefik/v3/pkg/server/service/loadbalancer/wrr/wrr.go:176 > Service selected by WRR: http://172.18.0.3:53

Also not surprising, Traefik Docker Documentation - Traefik documents as such. However, it documents the loadbalancer.server.port as a solution, but when you do that it barfs:

 error="field not found, node: loadbalancer" 

Not really sure where to go from here on this one, not sure if the documentation is bad or if I hit a bug. Sha is a9890c898f379c1905ee5b28342f6b408dc863f08db2dab20e46c267d1ff463a

Traefik splits label configuration between routers (matching) and services (target), check example:

    labels:
      - traefik.enable=true
      - traefik.http.routers.mywhoami.rule=Host(`whoami.example.com`)
      - traefik.http.services.mywhoami.loadbalancer.server.port=80
                     ^^^^^^^^

Note that this does not work, it implies a false sense of security, sockets are always read-write:

    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"

Thanks, looks like there was some pebcak in there. And it looks like I was pulling some samples from older versions of traefik docs, totally missed the banner at the top of the page last night.

Though it appears that some of the latest documentation also has that false sense of security Setup Traefik Proxy in Docker Standalone - Traefik

Let's see for how long (pull request) :wink:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.