Herr Derb
Herr Derb

Reputation: 5387

DNS lookup of external address in Quarkus application returns loopback address

I want to loopup the ip addresses of a headless kubernetes service to access each pod. When testing it on the very pod with getent hosts my-headless-service it returns the 2 expected ips. When I call InetAddress.getAllByName("my-headless-service") in my Quarkus application that runs on the same pod, I get the loopback address[localhost/127.0.0.1]

Are there any pit falls which I am not aware of when resolving a host name with Java?

Upvotes: 0

Views: 279

Answers (1)

Herr Derb
Herr Derb

Reputation: 5387

After wasting some time I discovered that quarkus has disabled name resolving by default due to security reasons. Setting quarkus.naming.enable-jndi=true resolves the problem and the lookup works as expected using InetAddress.

See -> Disabling JNDI by default https://groups.google.com/g/quarkus-dev/c/bp1wVF1yLXE

Upvotes: 0

Related Questions