<p>I have a local kubernetes cluster setup using the edge release of docker (mac). My pods use an env var that I've defined to be my DB's url. These env vars are defined in a config map as:</p>

<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: my-config 
data:
  DB_URL: postgres://user@localhost/my_dev_db?sslmode=disable
</code></pre>

<p>What should I be using here instead of localhost?  I need this env var to point to my local dev machine.</p>

<h1>Option 1 - Local Networking Approach</h1>

<p>If you are running minikube, I would recommend taking a look at the answers to this question: <a href="https://stackoverflow.com/questions/42268814/routing-an-internal-kubernetes-ip-address-to-the-host-system">Routing an internal Kubernetes IP address to the host system</a></p>

<h1>Option 2 - Tunneling Solution: Connect to an External Service</h1>

<p>A very simple but a little hacky solution would be to use a tunneling tool like ngrok: <a href="https://ngrok.com/" rel="nofollow noreferrer">https://ngrok.com/</a></p>

<h1>Option 3 - Cloud-native Development (run everything inside k8s)</h1>

<p>If you plan to follow the suggestions of whites11, you could make your life a lot easier with using a <strong>kubernetes-native dev tool</strong> such as DevSpace (<a href="https://github.com/covexo/devspace" rel="nofollow noreferrer">https://github.com/covexo/devspace</a>) or Draft (<a href="https://github.com/Azure/draft" rel="nofollow noreferrer">https://github.com/Azure/draft</a>). Both work with minikube or other self-hosted clusters.</p>
