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?
After wasting some time I discovered that quarkus has disabled name resolving by default due to security reasons. Setting
quarkus.naming.enable-jndi=trueresolves the problem and the lookup works as expected usingInetAddress.See -> Disabling JNDI by default https://groups.google.com/g/quarkus-dev/c/bp1wVF1yLXE