kubernetes and external DNS in ubuntu

2/15/2019

I have an ubuntu box out of the kubernetes cluster

My /etc/resolv.conf content

nameserver 10.3.0.1 (kubedns)

If i make a nslookup, everything works fine

nslookup spark-master-0.spark-master.ns.svc.cluster.local
Server:     10.3.0.1
Address:    10.3.0.1#53

Non-authoritative answer:
Name:   spark-master-0.spark-master.ns.svc.cluster.local
Address: 10.2.0.252

if i try to use any other tool (chrome, curl, ping, wget) i get an error:

curl spark-master-0.spark-master.ns.svc.cluster.local
curl: (6) Could not resolve host: spark-master-0.spark-master.ns.svc.cluster.local

The only way is to add search .cluster.local in /etc/resolv.conf, but now i cannot use the fqdn of the nodes

any tip on how to use the fqdn ?

Update The same setup in my mac works perfect ! the problem is only with my ubuntu 14.04.3

-- Jose
dns
dnsmasq
kube-dns
kubernetes

1 Answer

2/16/2019

It seems like FQDN is working fine with DNS but issue with the host system.

Can you try after changing the below entry in /etc/nsswitch.conf.

hosts:          files mdns4_minimal [NOTFOUND=return] dns

to

hosts:          files mdns4_minimal dns [NOTFOUND=return]

if above also not work then try putting only DNS.

hosts:          dns [NOTFOUND=return]
-- Vikram Jakhar
Source: StackOverflow