[SOLVED] Expose dashboard on separate port 8080 without hostname?

We run Docker Swarm and would like to expose the api/dashboard of every global Traefik instance on separate port 8080 on their corresponding host with a password.

The issue is that all the examples use a router with a hostname. How can we access the dashboard on the entrypoint without a hostname, we would just like to use IP:port? (And the IP can not be fixed because it is different on every node)

Traefik:

providers:
  docker:
    endpoint: "unix:///var/run/docker.sock"
    swarmMode: true
    exposedByDefault: false
    network: proxy
  file:
    filename: /dynamic.yml
    watch: true
    
entryPoints:
  web:
    address: :80
    http:
      redirections:
        entryPoint:
          to: websecure
          scheme: https
  websecure:
    address: :443
  traefik:
    address: :8080

api:
  debug: true
  dashboard: true
  insecure: false

Docker Swarm:

version: '3.9'

services:
  traefik:
    image: traefik:v2.8.3
    command: --configFile=/traefik.yml --log.level=DEBUG
    ports:
      # HTTP/S ports on host without ingress network
      - target: 80
        published: 80
        protocol: tcp
        mode: host
      - target: 443
        published: 443
        protocol: tcp
        mode: host
      # Traefik Web UI
      - target: 8080
        published: 8080
        protocol: tcp
        mode: host
    networks:
      - proxy
    volumes:
      # include docker.sock for service discovery
      - /var/run/docker.sock:/var/run/docker.sock
    configs:
      - traefik.yml
      - dynamic.yml
    deploy:
      mode: global

networks:
  # overlay network for routing to services
  proxy:
    name: proxy
    driver: overlay
    attachable: true

configs:
  traefik.yml:
    file: ./traefik.yml
  dynamic.yml:
    file: ./dynamic.yml

Dashboard on port 8080 (without hostname), secured with username/password.

Static configuration:

providers:
  file:
    filename: /dynamic.yml
    
entryPoints:
  web:
    address: :80
    http:
      redirections:
        entryPoint:
          to: websecure
          scheme: https
  websecure:
    address: :443
  traefik:
    address: :8080
    
api:
  debug: true
  dashboard: true
  insecure: false

Dynamic configuration:

http:
  routers:
    dashboard:
      entryPoints:
        - traefik
      rule: PathPrefix(`/api`) || PathPrefix(`/dashboard`)
      service: api@internal
      middlewares:
        - auth
  middlewares:
    auth:
      basicAuth:
        users:
          - "test:$$apr1$$H6uskkkW$$IgXLP6ewTrSuBkTrqE8wj/"

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