Api@internal in swarmMode

For a long time I have been struggling with enabling Dashboard on Traefik V2.x.x. in swarmMode. I'm not deep into the fabrics of Traefik, so I have no clue to why.

Basically if I enable "traefik.http.routers.api.service=api@internal" in the Traefik deployment, I get the dashboard, but all other services i deploy wil be inaccessable (404). If i remove the above line from Traefik all services will be available again, but Dashboard is then inaccessible (404).

I have trawled through almoste all examples out there and tested with multible versions of Traefik V2. without any success.

Just a guess here as I'm also struggling with some aspects of setting up my traefik swarm set, but I have managed to get both deployed services and my dashboard working as expected (just not over https which is my current challenge).

What else have you configured for traefik.http.routers.api.?

For comparison I have

- traefik.http.routers.dashboard.rule=Host(`dockerswarm-test.mydomain.com`)
- traefik.http.routers.dashboard.service=api@internal
1 Like

I have enabled api dashboard in the config file (traefik.yml) and in the service I have the following labels set. I have followed the docs about putting these in the deploy section, but that has also caused some trubles for me. So, I actually have better experience setting the labels on their own (without the deploy tag)

- "traefik.enable=true"
- "traefik.docker.network=traefik"
- "traefik.http.services.api.loadbalancer.server.port=8080"
- "traefik.http.routers.api.rule=Host(traefik.domain.com)"
- "traefik.http.routers.api.entrypoints=websecure"
- "traefik.http.routers.api.tls=true"
- "traefik.http.routers.api.tls.certresolver=letsencrypt"
- "traefik.http.routers.api.service=api@internal"
# Adding auth middleware
- "traefik.http.routers.api.middlewares=auth"
- "traefik.http.middlewares.auth.basicauth.users=admin:$$2y$$05$$4y9tsKSDKKnClb7Eo./OngJfvBAnx"
- node.role == manager

BTW. I have also tried with other names instead of "api", like "dashboard" etc.

I have grown to like Traefik very much as proxy and would rather not go back to Nginx, the samme matters for Docker Swarm, where I would rather not want to go back to K8s. But, there just seems to be these small unsolved problems from time to time.

hello @rune1979

Thanks for asking the question.

Would you please share your entire configuration with the correct YAML indentation? It is difficult to help you since the example you shared has an incorrect indentation.

However, you can also have a look at my old example (but it still should works) with Traefik Proxy and Docker Swarm. Here is the link:

I hope that helps.

Thank you,

Hi! A second resource that might help is this video by IBRACorp. It is a walk through of setting up Traefik 2.6 on Docker. Traefik v2.6+ | How to Install and Why You Should (plus Authelia, Traefik Pilot) - YouTube