Hi. When i have issues of similar sort, i always go for this article
It`s VERY detailed and has a lot of good practices.
Personally, i prefer configuring it via
labels:
- "traefik.enable=true"
## HTTP Routers
- "traefik.http.routers.portainer-rtr.entrypoints=https"
- "traefik.http.routers.portainer-rtr.rule=Host(`portainer.$DOMAINNAME_CLOUD_SERVER`)"
- "traefik.http.routers.portainer-rtr.tls=true"
## Middlewares
- "traefik.http.routers.portainer-rtr.middlewares=chain-basic-auth@file"
# - "traefik.http.routers.portainer-rtr.middlewares=chain-no-auth@file"
## HTTP Services
- "traefik.http.routers.portainer-rtr.service=portainer-svc"
- "traefik.http.services.portainer-svc.loadbalancer.server.port=9000"
Please note that entrypoints setup via CLI for Traefik container ,like this
command: # CLI arguments
- --entryPoints.http.address=:80
- --entryPoints.https.address=:443
My suggestion would be to not do every endpoint at once.
Create an entrypoint. Forget about middlewares for now.
Then configure setup like in lables.
- mare sure traefik is enabled
- create a router with clear name that this is, indeed, a router. Adding -rtr and -svc (like in the artricle) helped me a lot
- define entrypoint for the router; its rule.
- map router to a service!
- "traefik.http.routers.portainer-rtr.service=portainer-svc"
- explain the service where traffic should be redirected
- "traefik.http.services.portainer-svc.loadbalancer.server.port=9000"
Test it. Look trough Traefik logs. Use - --log.level=DEBUG if need be.
Your config is indeed getting messier and its quite difficult to understand what could go wrong where.
Also Traefik Configuration Documentation - Traefik :
"The Static Configuration
There are three different, mutually exclusive (i.e. you can use only one at the same time), ways to define static configuration options in Traefik:
In a configuration file
In the command-line arguments
As environment variables
These ways are evaluated in the order listed above."
So, you may have conflicts in configurations. I`m running 50+ services on multiple independend hosts; services on the same host as Traefik are configured via Lables, which is imho the easiest. Try doing one and poke me with what your logs say when you try to access it.