I am following this tutorial.
I have a service deployed and when I dig consul I get back
dig @127.0.0.1 -p 53 brad1.service.consul SRV
; <<>> DiG 9.16.1-Ubuntu <<>> @127.0.0.1 -p 53 brad1.service.consul SRV
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 5506
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 3
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;brad1.service.consul. IN SRV
;; ANSWER SECTION:
brad1.service.consul. 0 IN SRV 1 1 30000 0a016006.addr.nyc.consul.
;; ADDITIONAL SECTION:
0a016006.addr.nyc.consul. 0 IN A 10.1.96.6
app1.node.nyc.consul. 0 IN TXT "consul-network-segment="
;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Sun Aug 01 15:54:09 PDT 2021
;; MSG SIZE rcvd: 155
So to me this is working correctly. Now I know you are not haproxy, and if I need to ask there I will, but I thought I would start here first.
haproxy cfg.
#---------------------------------------------------------------------
# consul dns for server resolution
#---------------------------------------------------------------------
resolvers consul
nameserver consul 127.0.0.1:8600
accepted_payload_size 8192
hold valid 5s
backend default
http-request set-var(txn.username) req.hdr(Host),field(1,.),lower
server-template fvtt 10 _%[var(txn.username)]._tcp.service.nyc.consul resolvers consul resolve-prefer ipv4
In this case, the subdomain, is the username of the client. So in this query example the username/hostname is brad1. I have confirmed in the logs… that haproxy is getting the right username/subdomain name.
Aug 1 15:49:34 loadbalancer1 hapee-lb[15033]: 24.69.39.80:5636 [01/Aug/2021:15:49:34.724] http_in~ host_not_found/<NOSRV> 0/-1/-1/-1/0 503 222 - - SCNN 2/2/0/0/0 0/0 {brad1.domain.net|brad1} "GET / HTTP/1.1"
this log entry shows that haproxy can’t find a server "host_not_found/ " I have curled from the cli to make sure it is running and available on the right ip and port. I don’t know how to trouble shoot from here. Any help or thoughts would be greatly appreciated.
Brad