<p>I have a service (/deployment/pod) running in my Minikube (installed on my Mac) that needs to call an external http service that runs directly on my Mac (i.e. outside Minikube). The domain name of that external service is defined into my Mac /etc/hosts file. Yet, my service within Minikube cannot call that external service. Any idea what I need to configure where? Many thanks. C </p>

Christian68
<p>Create <code>Endpoints</code> that will forward traffic to your desire external IP address (your local machine). You can directly connect using <code>Endpoints</code> but according to <code>Goole Cloud best practice</code> (<a href="https://cloud.google.com/blog/products/gcp/kubernetes-best-practices-mapping-external-services" rel="nofollow noreferrer">doc</a>) is to access it through a <code>Service</code></p>
<p><a href="https://i.stack.imgur.com/gKLJd.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gKLJd.jpg" alt="enter image description here" /></a></p>
<p>Create your <code>Endpoints</code></p>
<pre><code>kind: Endpoints
apiVersion: v1
metadata:
 name: local-ip
subsets:
 - addresses:
     - ip: 10.240.0.4  # IP of your desire end point
   ports:
     - port: 27017     # Port that you want to access
</code></pre>
<p>Then create you <code>Service</code></p>
<pre><code>kind: Service
apiVersion: v1
metadata:
 name: local-ip
spec:
 type: ClusterIP
 ports:
 - port: 27017
   targetPort: 27017
</code></pre>
<p>Now you can call external http service using the <code>Service</code> name. In this case <code>local-ip</code> like any other internal service of <code>minikube</code>.</p>
