<p>I have two services in kubernetes sharing the same namespace.</p>
<p>I am trying to connect to <code>service B</code> from inside a pod that is associated with <code>service A</code>.</p>
<p>I exec into the pod that is associated with <code>service A</code> then try to send <code>curl</code> request to <code>service B</code>:</p>
<pre><code>curl service-b-beta.common-space.svc.cluster.local:7000
</code></pre>
<p>However, it returns the following error:</p>
<pre><code>curl: (6) Could not resolve host: service-b-beta.common-space.svc.cluster.local
</code></pre>
<p>service A:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  labels:
    name: service-a
  namespace: common-space
  name: service-a-beta
spec:
  ports:
  - name: http
    port: 7200
    protocol: TCP
    targetPort: 7200
  selector:
    name: service-a-beta
  sessionAffinity: None
  type: ClusterIP
</code></pre>
<p>Service B:</p>
<pre><code>apiVersion: v1
    kind: Service
    metadata:
      labels:
        name: service-b
      namespace: common-space
      name: service-b-beta
    spec:
      ports:
      - name: http
        port: 7000
        protocol: TCP
        targetPort: 7000
      selector:
        name: service-b-beta
      sessionAffinity: None
      type: ClusterIP
</code></pre>

bakadevops
<p>Here are some debugging tips:</p>
<ol>
<li>If running on multiple nodes, please make sure nodes can talk to each other.</li>
<li>Check if <code>coredns</code> pod on <code>master</code> is running and is healthy. See logs for any issues.</li>
<li>Run a test pod in the cluster and see if you can resolve internet domains. If failing then check your <code>coredns</code> for logs.</li>
<li>Run a test pod and check /etc/resolve.conf and see if it makes sense.</li>
<li>Check <code>coredns</code> config map in the system namespace. See if it looks normal</li>
<li>Describe the endpoints of the target service and see if it's bound correctly to the target pod.</li>
</ol>
