<p>I have minikube version v0.17.1 running on my machine. I want to simulate the environment I will have in AWS, where my MySQL instance will be outside of my Kubernetes cluster. </p>

<p>Basically, how can I expose my local MySQL instance running on my machine to the Kubernetes cluster running via minikube?</p>

<p>Kubernetes allows you to create a service without selector, and cluster will not create related endpoint for this service, this feature is usually used to proxy a legacy component or an outside component.</p>

<ol>
<li><p>Create a service without selector</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
    name: my-service
spec:
    ports:
        - protocol: TCP
          port: 1443
          targetPort: &lt;YOUR_MYSQL_PORT&gt;
</code></pre></li>
<li><p>Create a relative Endpoint object</p>

<pre><code>apiVersion: v1
kind: Endpoints
metadata:
    name: my-service
subsets:
    - addresses:
        - ip: &lt;YOUR_MYSQL_ADDR&gt;
      ports:
        - port: &lt;YOUR_MYSQL_PORT&gt;
</code></pre></li>
<li><p>Get service IP</p>

<pre><code>$ kubectl get svc my-service
NAME         CLUSTER-IP     EXTERNAL-IP   PORT(S)   AGE
my-service   &lt;SERVICE_IP&gt;   &lt;none&gt;        1443/TCP    18m
</code></pre></li>
<li><p>Access your MYSQL from service <code>&lt;SERVICE_IP&gt;:1443</code> or <code>my-service:1443</code></p></li>
</ol>
