Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Traefik is not picking up its own label in Swarm mode #5777

Closed
RomLecat opened this issue Nov 5, 2019 · 9 comments
Closed

Traefik is not picking up its own label in Swarm mode #5777

RomLecat opened this issue Nov 5, 2019 · 9 comments

Comments

@RomLecat
Copy link

RomLecat commented Nov 5, 2019

Do you want to request a feature or report a bug?

Bug

What did you do?

Using the following docker-compose in Swarm mode:

version: '3.2'

networks:
  lbnet:
    driver: overlay
    attachable: true

services:
  traefik:
    image: traefik:v2.0
    command:
      - "--api.dashboard=true"
      - "--providers.docker.endpoint=unix:///var/run/docker.sock"
      - "--providers.docker.swarmMode=true"
      - "--providers.docker.exposedbydefault=true"
      - "--providers.docker.network=traefik_lbnet"
      - "--entrypoints.web.address=:80"
      - "--entrypoints.websecure.address=:443"
      - "--certificatesresolvers.letsencrypt.acme.dnsChallenge.resolvers=1.1.1.1:53"
      - "--certificatesresolvers.letsencrypt.acme.dnsChallenge.provider=ovh"
      - "--certificatesresolvers.letsencrypt.acme.email=mail@domain.com"
      - "--certificatesresolvers.letsencrypt.acme.storage=acme.json"
    ports:
      - "80:80"
      - "443:443"
      - target: 8080
        published: 8080
        mode: host
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - /data/swarm-data/traefik/acme.json:/acme.json
    networks:
      - lbnet
    environment:
      - "OVH_ENDPOINT=ovh-eu"
      - "OVH_APPLICATION_KEY=REDACTED"
      - "OVH_APPLICATION_SECRET=REDACTED"
      - "OVH_CONSUMER_KEY=REDACTED"
    deploy:
      replicas: 2
      labels:
        - "traefik.http.routers.api.rule=Host(`traefik.dmz.internal.domain.com`)"
        - "traefik.http.routers.api.service=api@internal"
        - "traefik.http.routers.api.entrypoints=websecure"
        - "traefik.http.routers.api.tls.certresolver=letsencrypt"
        - "traefik.http.routers.api.middlewares=authelia-internal-io"
      placement:
        constraints: [node.role == manager]

What did you expect to see?

Dashboard should be available at provided URI and middleware enabled for it.
I also tried in insecure mode, dashboard is available at port 8080 and none of the configuration deployed on labels is present.
All labels on other containers in the Swarm are working properly.

What did you see instead?

Labels for the traefik containers are not working, they're not seen by Traefik (configuration not present from dashboard, tried multiple middlewares which works on other containers labels, nothing is picked up by Traefik).

Output of traefik version: (What version of Traefik are you using?)

Version:      2.0.4
Codename:     montdor
Go version:   go1.13.3
Built:        2019-10-28T20:23:57Z
OS/Arch:      linux/amd64

What is your environment & configuration (arguments, toml, provider, platform, ...)?

Swarm containers in CentOS 7. Every configuration is present above, only using command line and labels.

If applicable, please paste the log output in DEBUG level (--log.level=DEBUG switch)

N/A.

Please let me know if you need anything else.

@minbaby
Copy link

minbaby commented Nov 5, 2019

add - traefik.http.services.api.loadbalancer.server.port=8080 to labels, than got time="2019-11-05T12:46:36Z" level=error msg="the service \"api@internal\" does not exist" entryPointName=http routerName=api@docker

@RomLecat
Copy link
Author

RomLecat commented Nov 5, 2019

It does work when adding those lines (and replacing api@internal by api@docker).
But it's more a dirty hack than a real solution (since we're using a service instead of internal).

@minbaby
Copy link

minbaby commented Nov 5, 2019

image
https://docs.traefik.io/routing/providers/docker/#services

emmm.....
replace api@internal by api@docker, it works

@minbaby
Copy link

minbaby commented Nov 5, 2019

image
https://docs.traefik.io/routing/providers/docker/#services

emmm.....
replace api@internal by api@docker, it works

but got Gateway Timeout, when use 8080 port

@traefiker
Copy link
Contributor

Hi! I'm Træfiker 🤖 the bot in charge of communication regulation.

Thanks for your interest in Traefik!

We dedicate the issue tracker to bug reports and feature requests only. My advanced AI has spotted that your issue might be a configuration problem or relates to something that doesn't look like a bug.

To confirm this, please join our Community Forum and reach out to us on the Traefik section.

In case I'm wrong (well, that would be embarrassing 😅), my developers will re-open the issue and fix me!

In the meantime, you can double check Traefik's documentation.

@RomLecat
Copy link
Author

RomLecat commented Nov 5, 2019

IMO this is a bug and not a question, since we're using dashboard as a service with api.insecure but the documentation is speaking about "internal" and without api.insecure.
Also, defining middlewares (like http->https redirection) does not work in Traefik label, which is probably a bug.

@RomLecat
Copy link
Author

RomLecat commented Nov 5, 2019

image
https://docs.traefik.io/routing/providers/docker/#services
emmm.....
replace api@internal by api@docker, it works

but got Gateway Timeout, when use 8080 port

Did you enabled api.insecure ? It seems it needs to be enabled if you want Traefik to listen on 8080.

@dduportal
Copy link
Contributor

Hi @Hakujou , can you switch to the community forum please? It would be easier to get some help and exchanges.

The behavior you are describing is not buggy and is known to work: a quick search on the community forum will show you some other cases.

The documentation might need an improvement, but as we keep the issue tracker for proven bugs or feature request, it helps us a lot if you can switch to the forum.

Thanks for your understanding!

(PS: mention me on your forum topic and I'll be able to help you).

@RomLecat
Copy link
Author

RomLecat commented Nov 5, 2019

Sure, here you go: https://community.containo.us/t/traefik-doesnt-seem-to-work-with-api-internal-service/2805

@traefik traefik locked and limited conversation to collaborators Dec 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants