How do I run minikube from behind a VPN?

1/19/2017

I am no kind of networking genius, and I am a Kubernetes rookie. (What could possibly go wrong?)

At work, I am often behind a VPN. I have found that minikube operations hang attempting to connect to my minikube-installed Kubernetes cluster (I'm using VirtualBox on a Mac). When I disconnect from the VPN, everything works fine.

I've tried invoking minikube using something like env http_proxy=foo.bar.com https_proxy=foo.bar.com minikube whatever while on the VPN, but this merely reports that the network is unreachable (hey, at least it's not a hang).

This exhausts my staggering expertise in these two areas. :-)

Since it is merely an inconvenience, I find myself often disconnecting from and reconnecting to the VPN throughout the day, but I hate magic. Why am I encountering this behavior, and what can I do to fix it?

-- Laird Nelson
kubernetes
minikube

1 Answer

1/20/2017

It is the docker daemon inside minikube that can't connect to the internet.

If your VPN enforces a proxy then you need to start it with some docker environment variables. This is how I do it. It is dependent on the environment in my shell but you'll get the idea.

minikube start --docker-env HTTP_PROXY=$http_proxy --docker-env HTTPS_PROXY=$https_proxy

To access my minikube with kubectl I also have to add it's ip to NO_PROXY

export NO_PROXY=$NO_PROXY,$(minikube ip)
export no_proxy=$no_proxy,$(minikube ip)
-- Andreas Wederbrand
Source: StackOverflow