<p>Is there a way to expose the API server of a Kubernetes cluster created with <code>minikube</code> on a public network interface to the LAN?</p>

<p><code>minikube start --help</code> talks about this option (and two similar ones):</p>

<pre><code>  --apiserver-ips ipSlice \
    A set of apiserver IP Addresses which are used in the generated \
    certificate for localkube/kubernetes. This can be used if you \
    want to make the apiserver available from outside the machine (default [])
</code></pre>

<p>So it seems to be possible. But I can't figure out how or find any further information on that.</p>

<p>I naively tried:</p>

<pre><code>minikube start --apiserver-ips &lt;ip-address-of-my-lan-interface&gt;
</code></pre>

<p>But that just yields an utterly dysfunctional minikube cluster that I can't even access from localhost.</p>

<hr>

<p>Following the advise in one answer below I added port forwarding to Kubernetes like this:</p>

<pre><code>vboxmanage controlvm "minikube" natpf1 "minikube-api-service,tcp,,8443,,8443"
</code></pre>

<p>And then I can actually access the API server from a different host on the network with:</p>

<pre><code>curl --insecure https://&lt;ip-address-of-host-running-minikube&gt;:8443
</code></pre>

<p>But the response is:</p>

<pre><code>{
  "kind": "Status",
  "apiVersion": "v1",
  "metadata": {

  },
  "status": "Failure",
  "message": "forbidden: User \"system:anonymous\" cannot get path \"/\"",
  "reason": "Forbidden",
  "details": {

  },
  "code": 403
}
</code></pre>

<p>There are two problems with this:</p>

<ol>
<li>I have to use <code>--insecure</code> for the <code>curl</code> call, otherwise I get a SSL validation error.</li>
<li>I get a response, but the response is just telling me that I'm not allowed to use the API...</li>
</ol>

<p>The big source of your headache is that minikube runs in a VM (usually) with it's own IP address. For security, it generates some self signed certificates and configures the api command line tool, kubectl to use them. The certs are self signed with the VM IP as the host name for the cert.</p>

<p>You can see this if you use <code>kubectl config view</code>. Here's mine:</p>

<pre><code>apiVersion: v1
clusters:
- cluster:
    certificate-authority: /home/sam/.minikube/ca.crt
    server: https://192.168.39.226:8443
  name: minikube
contexts:
- context:
    cluster: minikube
    user: minikube
  name: minikube
current-context: minikube
kind: Config
preferences: {}
users:
- name: minikube
  user:
    client-certificate: /home/sam/.minikube/client.crt
    client-key: /home/sam/.minikube/client.key
</code></pre>

<p>Let's unpack that.</p>

<p><code>server: https://192.168.39.226:8443</code> - this tells kubectl where the server is. In a vanilla minikube setup, it's <code>https://&lt;ip-of-the-vm&gt;:8443</code>. Note that its https. </p>

<p><code>certificate-authority: /home/sam/.minikube/ca.crt</code> - this line tells the tool what certificate authority file to use to verify the TLS cert. Because it's a self signed cert, even in vanilla setups, you'd have to either inform curl about the certificate authority file or use <code>--insecure</code>.</p>

<pre><code>- name: minikube
  user:
    client-certificate: /home/sam/.minikube/client.crt
    client-key: /home/sam/.minikube/client.key
</code></pre>

<p>This chunk specifies what user to authenticate as when making commands - that's why you get the unauthorized message even after use <code>--insecure</code>.</p>

<p>So to use the minikube cluster from a different IP you'll need to:
 1) Use the <code>--apiserver-ips &lt;target-ip-here&gt;</code> (so the cert minikube generates is for the correct IP you'll be accessing it from) 
 2) Forward the 8443 port from the minikube vm to make it available at <code>&lt;target-ip-here&gt;:8443</code>
 3) Publish or otherwise make available the cert files referenced from <code>kubectl config view</code>
 4) Setup your kubectl config to mimic your local kubectl config, using the new ip and referencing the published cert files.</p>
