Hello,
I'm building my first gRPC service and I'm having trouble on the service discovery side. As an alternative to using a Layer 3 load balancer I'm trying to use a set of SRV records. Both server and client are in NodeJS, and I'm using whatever is installed using "npm install grpc", version flag "^1.12.3".
My understanding from reading the code is that this is implemented in the c-ares DNS implementation but not the native DNS implementation, but I can't seem to get the client runtime to load the c-ares DNS implementation. I've attempted both running natively on macOS and via a container using node:8-slim as the base.
I've proved that my container can resolve the DNS entry properly, which I've set up using dnsmasq on my host machine.
$ docker run --dns 192.168.1.22 -e GRPC_TRACE=all craigf/service:latest dig srv service.craigf.local
<SNIP>
;; ANSWER SECTION:
service.craigf.local. 0 IN SRV 0 0 5000 192.168.1.22.
(My server is bound to port 5000 on my host machine)
My client code is creating it's client like this:
var client = new Health(
'dns:///service.craigf.local',
grpc.credentials.createInsecure(),
{
'lb_policy_name': 'round_robin'
}
);
But the logs are always showing "dns_resolver.cc:339] Using native dns resolver", even when I attempt to force the c-ares implementation using GRPC_DNS_RESOLVER=ares. My test client eventually times out with a "Name resolution failure" message.
What am I missing here?'
Thanks,
Craig