pod dns is not resolved in k8s


I have 2 services named A and B

I have pods a1,a2,a3 for Service A.

I have pods b1,b2,b3 for Service B.

Service A -> Type = ClusterIP

Service B -> Type= LoadBalancer

if I try to do nslookup from a1 -> b1 I am getting below error.

  >kubectl exec a1 -- nslookup b1

  nslookup: can't resolve '(null)': Name does not resolve
  nslookup: can't resolve 'cassandra-0': Name does not resolve
  command terminated with exit code 1

please help me to find the issue and why it's not reachable from other pods

updated with actual info::

                                    root-user> kubectl get  services --all-namespaces -o wide
        NAMESPACE     NAME                   TYPE           CLUSTER-IP       EXTERNAL-IP                                                               PORT(S)                      AGE       SELECTOR
        default       kubernetes             ClusterIP       <none>                                                                    443/TCP                      26d       <none>
        default       registration-service   ClusterIP      None             <none>                                                                    8080/TCP                     18d       app=registration-service
        default       app-framework          ClusterIP      None             <none>                                                                    24366/TCP                    25d       app=app-framework
        default       stt                    LoadBalancer      a548cdb75447611e897960efe53682ba-1445165219.us-east-2.elb.amazonaws.com   8443:31327/TCP               3d        app=stt
        kube-system   kube-dns               ClusterIP      <none>                                                                    53/UDP,53/TCP                26d       k8s-app=kube-dns
        kube-system   kubernetes-dashboard   ClusterIP    <none>                                                                    443/TCP                      26d       k8s-app=kubernetes-dashboard
-- Slok

1 Answer


It works as described in the docs. Here a simple example:

# in one terminal: 
$ kubectl run -i -t --rm there --restart=Never --image=quay.io/mhausenblas/jump:0.2 -- sh

# in another terminal
$ kubectl describe pod there | grep IP
$ kubectl run -i -t --rm here --restart=Never --image=quay.io/mhausenblas/jump:0.2 -- sh
~ $ nslookup 172-17-0-7.default.pod
nslookup: can't resolve '(null)': Name does not resolve

Name:      172-17-0-7.default.pod
Address 1:
-- Michael Hausenblas
Source: StackOverflow