Linkerd with Consul

Hi. I am in the process of exploring various features linkerd provides. I also have some sidecar deployment with Consul as my service discovery. But I am not able to succeed any http requests and it always ends up in saying Host header is absent. I have tried both using setHost as false and true in the linkerd config. I have also changed my dtab accordingly. Is there anything that needs to be done other than this?

Hi Prasaanth,

You’re going to have to give us a few more details. Can you give us an example curl command and the error output? Is this with Kubernetes, or Mesos, or something else?

Hi William,

I am not running it on anything and am running a stand alone linkerd instance.
I tried with the following curl command setting the host to true.

"curl -H “Host:spring-boot.service.local.consul” http://HOST:IP
where spring-boot is my service name and local is my datacenter name configured with Consul.

I end up getting the following error
"io.buoyant.router.RoutingFactory$UnknownDst: Unknown destination: Request(“GET /path/to/resource”, from / / Host header is absent"

How should the host header be when it is set to false?

Can you share your linkerd config? When testing with a standard linkerd config I don’t see that error:

$ curl -H "Host:spring-boot.service.local.consul" http://localhost:4140
No hosts are available for /svc/spring-boot.service.local.consul, Dtab.base=[/svc=>/#/io.l5d.fs], Dtab.local=[]. Remote Info: Not Available

If you’re using the consul.yaml example from the linkerd/examples directory then you should be able to just specify the name of the service in the Host header like this:

curl -H "Host: spring-boot" http://localhost:4140

Hi Alex,

The following is my linkerd config. The error occurs when using the consul namer and not with fs.

  port: 9990

- kind: io.l5d.consul
  port: 4000
  includeTag: false
  useHealthCheck: true
  setHost: false
  consistencyMode: stale

- protocol: http
  dtab: |
    /svc => /#/io.l5d.consul/local/spring-boot;
  httpAccessLog: logs/access.log
  label: int
  - port: 4140
      kind: ewma
      maxEffort: 10
      decayTimeMs: 15000
      kind: io.l5d.successRate
      successRate: 0.9
      requests: 5
        kind: jittered
        minMs: 5000
        maxMs: 300000
- kind: io.l5d.prometheus

I think your dtab should be either

/svc/* => /#/io.l5d.consul/.local/spring-boot;

To send all requests to the spring-boot service or

/svc => /#/io.l5d.consul/.local;

To send requests to the service from the Host header.

Notice that the .local segment has a dot at the beginning. This is a special keyword that indicates the local DC. Then a curl command like this should work:

curl -H "Host: spring-boot" http://localhost:4140

Thanks Alex. Let me try that.

Great! Let me know how it goes.

Hello Prasaant,
I am facing similar issue. Is it possible for you to share you sample code with me?