<p>On my Kubernetes Setup, i have 2 Services - A and B.<br>
Service B is dependent on Service A being fully started through. 
I would now like to set a TCP Readiness-Probe in Pods of Service B, so they test if any Pod of Service A is fully operating.</p>

<p>the ReadinessProbe section of the deployment in Service B looks like:</p>

<pre><code>readinessProbe:
  tcpSocket:
    host: serviceA.mynamespace.svc.cluster.local
    port: 1101 # same port of Service A Readiness Check
</code></pre>

<p>I can apply these changes, but the Readiness Probe fails with:</p>

<pre><code>Readiness probe failed: dial tcp: lookup serviceB.mynamespace.svc.cluster.local: no such host
</code></pre>

<p>I use the same hostname on other places (e.g. i pass it as ENV to the container) and it works and gets resolved. </p>

<p>Does anyone have an idea to get the readiness working for another service or to do some other kind of dependency-checking between services? 
Thanks :)</p>

tom-tr
<p>Due to the fact that Readiness and Liveness <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/" rel="nofollow noreferrer">probes</a> are fully managed by <code>kubelet</code> node agent and <a href="https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet/" rel="nofollow noreferrer">kubelet</a> inherits DNS discovery service from the particular Node configuration, you are not able to resolve K8s internal nameserver <a href="https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/" rel="nofollow noreferrer">DNS</a> records:</p>

<blockquote>
  <p>For a probe, the kubelet makes the probe connection at the <strong>node</strong>, not
  in the <strong>pod</strong>, which means that you can not use a service name in the
  host parameter since the kubelet is unable to resolve it.</p>
</blockquote>

<p>You can consider scenario when your source <strong>Pod A</strong> consumes Node IP Address by propagating <code>hostNetwork: true</code> parameter, thus <code>kubelet</code> can reach and success Readiness probe from within <strong>Pod B</strong>, as described in the official k8s <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes" rel="nofollow noreferrer">documentation</a>:</p>

<pre><code>tcpSocket:
  host: Node Hostname or IP address where Pod A residing
  port: 1101
</code></pre>

<p>However, I've found Stack <a href="https://stackoverflow.com/questions/51079849/kubernetes-wait-for-other-pod-to-be-ready">thread</a>, where you can get more efficient solution how to achieve the same result through <a href="https://kubernetes.io/docs/concepts/workloads/pods/init-containers/#what-can-init-containers-be-used-for" rel="nofollow noreferrer">Init Containers</a>.</p>
