<p>Usecase:
I have a Docker desktop and kubernetes enabled within it. From the kubernetes node, I want to connect to a database running on my laptop without using my laptop's ip address.</p>
<p>I want to refer to the Windows Host machine from within Kuberntes Endpoint without using the dynamic IP of the host. In docker there is a special DNS name host.docker.internal that allows host machine endpoints to be connected. I am not able to specify this for the endpoint IP. Is there something equivalent in Kubernetes?</p>

<p>Use <code>host.docker.internal</code>.</p>
<p>I've tested on Mac, but it should work the same for Windows.</p>
<ol>
<li><p>Spin up an alpine pod (deployment yaml <a href="https://github.com/infrabricks/kubernetes-standalone/blob/master/examples/alpine.yml" rel="nofollow noreferrer">borrowed from rossbackp</a>).</p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: alpine
  namespace: default
spec:
  containers:
  - image: alpine:3.2
    command:
      - /bin/sh
      - &quot;-c&quot;
      - &quot;sleep 60m&quot;
    imagePullPolicy: IfNotPresent
    name: alpine
  restartPolicy: Always
</code></pre>
<pre class="lang-bash prettyprint-override"><code>kubectl apply -f deployment.yaml  # after saving the above file as deployment.yaml
</code></pre>
</li>
<li><p>Start a simple web server, on the host.</p>
<pre class="lang-bash prettyprint-override"><code>mkdir /tmp/server
cd /tmp/server
echo &quot;hi&quot; &gt; index.html
python -m SimpleHTTPServer 8000
</code></pre>
</li>
<li><p>Access the web server from the alpine pod.</p>
<pre class="lang-bash prettyprint-override"><code>kubectl exec -it alpine -- sh
wget -O- host.docker.internal:8000
</code></pre>
</li>
</ol>
