<p>While running Minikube, I want to connect to a server that has the annoying habit of announcing itself to a service registry with its internal IP address from inside its pod. </p>

<p>However for legacy reasons I have to connect to this registry first and retrieve that server's ip address from it. The only way to access this server from my dev machine, it seems to me, is bridging to the internal network, so I can access the  networking of the Minikube. Is there an easy way to do this?</p>

<p>You can add a route to the k8 internal network from localhost</p>

<p>Add a route to the internal network using the minikube ip address</p>

<pre><code>$ sudo ip route add 172.17.0.0/16 via $(minikube ip)  # linux
$ sudo route -n add 172.17.0.0/16 $(minikube ip) # OSX
</code></pre>

<p>your subnet mask could be found using <code>kubectl get service</code> command</p>

<p>Test the route by deploying a test container and connect to it from localhost</p>

<pre><code>$ kubectl run monolith --image=kelseyhightower/monolith:1.0.0 --port=80
$ IP=$(kubectl get pod  -l run=monolith -o jsonpath='{.items[0].status.podIP }')
$ curl http://$IP
{"message":"Hello"}
</code></pre>

<p>You can also add a route to K8 master</p>

<pre><code>sudo route -n add 10.0.0.0/24 $(minikube ip)
</code></pre>

<p>This is only useful for local development, you should use <code>NodePort</code> or <code>LoadBalancer</code> for exposing pods in production.</p>
