Consul-catalog migration to 2.x not working

Hi there!

I'm trying to migrate a traefik job on Nomad from 1.7 to 2.2. Here's my current setup:

Traefik receives traffic from the load balancer and checks if the request is addressed to mydomain.com. These are the params it receives upon launch:

args = [
          "traefik",
          "--ping",
          "--api",
          "--consulcatalog=true",
          "--consulcatalog.endpoint=${attr.unique.network.ip-address}:8500",
          "--consulcatalog.domain=mydomain.com",
          "--consulcatalog.constraints=tag==tooling",
          "--consulcatalog.prefix=traefik-frontend-tooling"
        ]

Then, I just have a tag on my service that makes it work.

   service {
        tags = [
          "traefik-frontend-tooling.tags=tooling"

Now, when I tried migrating it to 2.2, this is what my traefik job looked like:

args = [
          "traefik",
          , "--ping"
          , "--api.insecure=true"
          , "--providers.consulcatalog=true"
          , "--providers.consulcatalog.endpoint.address=http://${attr.unique.network.ip-address}:8500"
          , "--providers.consulcatalog.constraints=Tag(`traefik2-frontend-tooling.tags=tooling`)"
          , "--providers.consulcatalog.prefix=traefik2-frontend-tooling"
          , "--entryPoints.web.address=:80"
        ]

and now my service contains the tag and the router rule:


  service {
        tags = [
          "traefik2-frontend-tooling.tags=tooling"
          , "traefik.http.routers.myservice.rule=Host(`myservice.mydomain.com`)"          
        ]

When I launched the new jobs I could see in the UI that my service registered in the HTTP Services as I expected, but calls to atlantis.mydomain.com were returning 404.

I'm feeling that I'm close to the right config and also that my problem may lie in the use of --consulcatalog.domain=mydomain.com in version 1.7. I can't find any equivalents to that in the 2.x documentation.

Anyways, hope this was clear enough and hope to hear from the community soon!
Cheers

FIXED!

This is the config that worked, without needing to change anything on the backend services.

    args = [
      "traefik",
      "--api.insecure",
      "--providers.consulcatalog.endpoint.address=${attr.unique.network.ip-address}:8500",
      "--providers.consulcatalog.constraints=Tag(`mytagname.tags=value`)",
      "--providers.consulcatalog.defaultrule=Host(`{{ normalize .Name }}.mydomain.com`)"
    ]
1 Like

I have an issue too but my issue is just using localhost and pathprefix after port forwarding is not working and my annotations are not working. I am not using nomad. Is the defaultrule host a requirement? "--providers.consulcatalog.defaultrule=Host({{ normalize .Name }}.mydomain.com)"

Also can it be any domain when you set hostname?