UnknownHostException in Kubernetes-Container

4/14/2016

My application running within Kubernetes cannot resolve an internal hostname, throwing

java.net.UnknownHostException: [my_server_hostname]

The containers resolv.conf content is

nameserver 8.8.8.8
nameserver 8.8.4.4

The hosts resolv.conf contains the correct ip (not 127.0.0.1).

I tried to add an entry via Dockerfile

RUN ["echo", "nameserver [my_dns_ip]", "> /etc/resolv.conf"]

but this did not work.

Using the IP instead of the hostname works.

-- pma
dns
docker
kubernetes

0 Answers