<p>I'm working locally (within Docker for Mac) on a Kubernetes cluster that will eventually be deployed to the cloud. We plan to use a database service in that environment. To simulate that, I'd like to have the services in the cluster connect to a database running outside the cluster on my laptop.</p>
<p>Can I do that? Here's what I thought I'd try.</p>
<ul>
<li>Define a <code>Service</code> with <code>type: ExternalName</code> and <code>externalName: somedb.local</code></li>
<li>Add <code>127.0.0.1 somedb.local</code> to <code>/etc/hosts</code> on the laptop</li>
</ul>
<p>Is that correct? Is there a better way?</p>

<p>After talking with some colleagues, I found a solution.</p>
<p>In Docker for Mac, <code>host.docker.internal</code> points to the host machine, and that lets me connect to the db running there, even from containers running in the K8s cluster.</p>
