I’m trying to use kubernetes resolver (coredns) to resolve the servers, but it doesn’t work. I did a tcpdump of the DNS queries that HAproxy sends:
20:25:00.164952 IP jira-nginx-764f99df4f-v7r24.56180 > kube-coredns.kube-system.svc.cluster.local.domain: 13876+ [1au] Type0 (Class 7168)? jira.staging.svc.cluster.local. (60)
20:25:00.165297 IP kube-coredns.kube-system.svc.cluster.local.domain > jira-nginx-764f99df4f-v7r24.56180: 13876 FormErr- 0/0/0 (48)
20:25:00.165340 IP jira-nginx-764f99df4f-v7r24.56180 > kube-coredns.kube-system.svc.cluster.local.domain: 13876+ [1au] Type0 (Class 256)? jira.staging.svc.cluster.local. (60)
20:25:00.165710 IP kube-coredns.kube-system.svc.cluster.local.domain > jira-nginx-764f99df4f-v7r24.56180: 13876 FormErr- 0/0/0 (48)
I’m not clear why it send invalid DNS queries, Wireshark says the DNS queries are malformed.
I have tested with dig, and it returns the correct results, it also works correctly with nginx.
Config:
global
log stdout local0
stats socket 127.0.0.1:9000 mode 660 level admin
frontend ft_web
mode http
bind 127.0.0.1:8080
default_backend bk_web
stats enable
stats uri /ha
stats refresh 5s
resolvers mydns
parse-resolv-conf
accepted_payload_size 512
backend bk_web
mode http
balance roundrobin
cookie JSESSIONID prefix nocache
server-template jira 5 jira.staging.svc.cluster.local.:8080 check resolvers mydns init-addr none resolve-prefer ipv4