<p>The following pod definition <em>successfully</em> executes a <code>readinessProbe</code>, which makes a request to the service <code>service-am-i-ready</code> that connects to pods on the same cluster.</p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  creationTimestamp: null
  labels:
    run: ready-if-service-ready
  name: ready-if-service-ready
spec:
  containers:
  - image: nginx:1.16.1-alpine
    name: ready-if-service-ready
    resources: {}
    livenessProbe:                                     
      exec:
        command:
        - 'true'
    readinessProbe:
      exec:
        command:
        - sh
        - -c
        - 'wget -T2 -O- http://service-am-i-ready:80'  
  dnsPolicy: ClusterFirst
  restartPolicy: Always
status: {}
</code></pre>
<p>However, if I change the <code>readinessProbe.exec.command</code> to <code>readinessProbe.httpGet</code> it doesn't work anymore:</p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  creationTimestamp: null
  labels:
    run: ready-if-service-ready
  name: ready-if-service-ready
spec:
  containers:
  - image: nginx:1.16.1-alpine
    name: ready-if-service-ready
    resources: {}
    livenessProbe:                                     
      exec:
        command:
        - 'true'
    readinessProbe:
      httpGet:                         # Only changed this method
        host: service-am-i-ready
        path: /
        port: 80
        scheme: HTTP 
  dnsPolicy: ClusterFirst
  restartPolicy: Always
status: {}
</code></pre>
<p>This is the error message I get running <code>kubectl po describe ready-if-service-ready</code>:</p>
<pre><code>Warning  Unhealty  3m10s  (x139 over 23m)  kubelet  Readiness probe  failed: Get &quot;http://service-am-i-ready:80/&quot;: dial tcp: lookup service-am-i-ready: no such host
</code></pre>
<p>Running <code>kubectl get po ready-if-service-ready</code> gives:</p>
<pre><code>NAME                    READY       STATUS      RESTARTS        AGE
ready-if-service-ready  0/1         Running     0               27m
</code></pre>
<p>Why is the first readinessProbe working, but not the second one? It looks like the second readinessProbe makes a request to the same endpoint as the <code>wget -T2 -O- http://service-am-i-ready:80</code> command.</p>

Moritz Wolff
<p>@glv's answer is also correct, but let me explain you why it is not working and what is the otherway</p>
<p>The reason is <strong>wget</strong> uses the <strong>DNS resolver configured in the pod</strong>, which is set to the Kubernetes DNS service by default.</p>
<p><strong>httpGet probe</strong>, which is executed by the kubelet on the node hosting the pod. The kubelet <strong>does not use the DNS resolver configured in the pod</strong>, but rather the host's DNS resolver configuration</p>
<p>You can modify your readiness probe to use the IP address of the pod providing the service instead of the hostname.</p>
<pre><code>readinessProbe:
  httpGet:
    host: (POD_IP)
    path: /
    port: 80
    scheme: HTTP 
</code></pre>
<p>You can dyamically assign IP by this way as well</p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  creationTimestamp: null
  labels:
    run: ready-if-service-ready
  name: ready-if-service-ready
spec:
  containers:
  - image: nginx:1.16.1-alpine
    name: ready-if-service-ready
    resources: {}
    env:
    - name: MY_POD_IP
      valueFrom:
        fieldRef:
          fieldPath: status.podIP
    livenessProbe:                                     
      exec:
        command:
        - 'true'
    readinessProbe:
      httpGet:
        host: $(MY_POD_IP)
        path: /
        port: 80
        scheme: HTTP 
  dnsPolicy: ClusterFirst
  restartPolicy: Always
status: {}
</code></pre>
