Traefik v2 with gRPC (h2c) using Consul catalog

Hello folks. Much thanks for Traefik v2.

I am using traefik version in a stand-alone LB mode (no k8s/k3s):

$ traefik version
Version:      2.1.6
Codename:     cantal
Go version:   go1.13.8
Built:        2020-02-28T17:40:18Z
OS/Arch:      linux/amd64

And I am trying to set it up with gRPC service (on h2c) that register to Consul using service tags. I am using the following traefik.toml configuration:

traefik.toml

[entryPoints]
  [entryPoints.http]
    address = ":80"

[providers]
  providersThrottleDuration = "2s"

[api]
  insecure = true
  dashboard = true

[log]
  level = "DEBUG"

[accessLog]
  format = "json"
  bufferingSize = 0

[providers.consulCatalog]
  refreshInterval = "10s"
  prefix = "hello"
  constraints = "Tag(`hello.svc=service1`)"
  [providers.consulCatalog.endpoint]
    address = "consul.dev.gg.local:8500"

My service register to Consul using the following service tags (K/V) and I can see them healthy in Consul. The service's name is service1.

hello.svc=service1
traefik.http.services.service1.loadbalancer.server.scheme=h2c
traefik.http.services.service1.loadbalancer.server.url=h2c://10.71.8.94:7001
traefik.http.services.service1.loadbalancer.server.port=7001

However, I have only been able to see http scheme as the load balanced URL in traefik's DEBUG log (there is no h2c for e.g.):

{
  "http": {
    "routers": {
      "service1": {
        "service": "service1",
        "rule": "Host(`service1`)"
      }
    },
    "services": {
      "service1": {
        "loadBalancer": {
          "servers": [
            {
              "url": "http://10.71.8.94:7001"
            }
          ],
          "passHostHeader": true
        }
      }
    }
  },
  "tcp": {}
}

And I can't get my gRPC client to connect and send HTTP/2 requests:

$ ./greeter_client 10.198.2.2:80 # traefik's entrypoint.
could not greet: rpc error: code = Unimplemented desc = Not Found: HTTP status code 404; transport: received the unexpected content-type "text/plain; charset=utf-8"

Could someone tell me what is it that I am doing wrong? I have read myriad number of pages of docs but might have missed it.

[edit]
I also tried to register the following service tag to Consul from my gRPC server but still no dice:

traefik.protocol=h2c

I picked up that from one of the merged pull request on Traefik's GH.

Thank you in advance.

1 Like

bumping up in case anyone missed my question :slight_smile:

Hi, where do you exactly add the service tags?
these hello.svc=service1
traefik.http.services.service1.loadbalancer.server.scheme=h2c
traefik.http.services.service1.loadbalancer.server.url=h2c://10.71.8.94:7001
traefik.http.services.service1.loadbalancer.server.port=7001

Are they labels or annotations within the yaml?

Please let me know.