I’ve recently had a problem with exposing my minikube to the outer world. The use case was to test the cluster from mobile device. Officially minikube supports “host-only” network interface. Fortunately, there is a way to access minikube cluster from external world, and it’s quite simple, but nowhere documented.
There is one downside to this method: I had to use virtualbox driver for spinning up cluster as I still don’t know whether you can forward ports using xhyve.
First we need to create minikube cluster using VirtualBox driver
By default minikube creates two network interfaces. One host-only adapter and one NAT network, which we can use for the purposes described above.
We will map port 51926 to 80 (HTTP) and port 51927 into port 443 (HTTPS) of our cluster.
Let’s port-forward ports HTTP and HTTPS into our minikube machine using virtualbox command line utility:
vboxmanage controlvm "minikube" natpf1 "http,tcp,,51926,,80" vboxmanage controlvm "minikube" natpf1 "https,tcp,,51927,,443"
minikube is the name of virtual machine,
natpf1 is the NAT network interface of VM,
https is the name of the forwarding, the rest is pretty easy to guess :)
You can do excactly the same thing by opening VirtualBox application, finding your virtual machine named
minikube, going to
Adapter 1 should be Attached to NAT)-> Advanced -> Port Forwarding
From there you can manually put host and machine port numbers that you want to forward.
That’s it! You should be able to access your cluster using your machine’s IP and ports above.