title: DNS lookup not working properly in Kubernetes cluster
body: <p>I spin up a cluster with minikube then apply this dummy deployment/service</p>
  
  <pre><code>apiVersion: apps/v1
  kind: Deployment
  metadata:
    name: nginx-deployment
  spec:
    selector:
      matchLabels:
        run: nginx-label
    replicas: 2
    template:
      metadata:
        labels:
          run: nginx-label
      spec:
        containers:
        - name: nginx-container
          image: nginx
          ports:
          - containerPort: 80
  ---
  apiVersion: v1
  kind: Service
  metadata:
    name: nginx-service
    labels:
      run: nginx-label
  spec:
    ports:
    - port: 1234
      targetPort: 80
      protocol: TCP
    selector:
      run: nginx-label
  </code></pre>
  
  <p>Then I create a dummy curl pod to test internal network with the following</p>
  
  <pre><code>kubectl run curl --image=radial/busyboxplus:curl -i --tty
  </code></pre>
  
  <p>Inside that curl instance, I'm able to access the nginx with <code>$NGINX_SERVICE_SERVICE_HOST:$NGINX_SERVICE_SERVICE_PORT</code> or <code>nginx-service.default:1234</code>, but not <code>nginx-service:1234</code>, even though those pods belong to the same namespace. </p>
  
  <pre><code>ubuntu:~$ kubectl get pods --namespace=default
  NAME                                READY   STATUS    RESTARTS   AGE
  curl-69c656fd45-d7w8t               1/1     Running   1          29m
  nginx-deployment-58595d65fc-9ln25   1/1     Running   0          29m
  nginx-deployment-58595d65fc-znkqp   1/1     Running   0          29m
  
  </code></pre>
  
  <p>Any idea what could cause this? Following is the nslookup result</p>
  
  <pre><code>[ root@curl-69c656fd45-d7w8t:/ ]$ nslookup nginx-service
  Server:    10.96.0.10
  Address 1: 10.96.0.10 kube-dns.kube-system.svc.cluster.local
  
  Name:      nginx-service
  Address 1: 23.202.231.169 a23-202-231-169.deploy.static.akamaitechnologies.com
  Address 2: 23.217.138.110 a23-217-138-110.deploy.static.akamaitechnologies.com
  [ root@curl-69c656fd45-d7w8t:/ ]$ nslookup nginx-service.default
  Server:    10.96.0.10
  Address 1: 10.96.0.10 kube-dns.kube-system.svc.cluster.local
  
  Name:      nginx-service.default
  Address 1: 10.103.69.73 nginx-service.default.svc.cluster.local
  [ root@curl-69c656fd45-d7w8t:/ ]$ 
  
  </code></pre>
  
  <p>Update: here's the content of <code>/etc/resolv.conf</code></p>
  
  <pre><code>[ root@curl-69c656fd45-d7w8t:/ ]$ cat /etc/resolv.conf 
  nameserver 10.96.0.10
  search default.svc.cluster.local svc.cluster.local cluster.local attlocal.net
  options ndots:5
  [ root@curl-69c656fd45-d7w8t:/ ]$ 
  </code></pre>