Access Kubernetes DNS server in node

11/15/2016

I'm trying to access Kubernetes internal DNS server from a node (not a pod).

Everything is working just fine for inter pods communications, but now I have a use case where I need a non docker/k8s app to access a service in kubernetes.

Since my app doesn't use k8s internal DNS, I cannot use the service name to access it. Is there a way to tell my node to use Kubernetes dns ?

-- benjamin.d
dns
kubernetes
linux

1 Answer

11/16/2016

Kubernetes use skyDNS and Kube2sky for DNS server. Kube2sky maintain k8s related DNS records such as service name, while skyDNS read these records from ETCD. So you can add k8s DNS nameserver and search domain into system DNS configuration. For example, your k8s DNS server is 10.16.42.197, search domain is domeos.sohu, and your app is running in Centos 7. So you need add nameserver 10.16.42.197 and search default.svc.domeos.sohu svc.domeos.sohu domeos.sohu into /etc/resolv.conf file.

-- openxxs
Source: StackOverflow