Minikube: Starting minikube behind a proxy

Created on 29 Aug 2016  Â·  24Comments  Â·  Source: kubernetes/minikube

BUG REPORT

Minikube version (use minikube version):
minikube version: v0.7.1

Environment:

  • OS (e.g. from /etc/os-release): NAME="Ubuntu"
    VERSION="14.04.2 LTS, Trusty Tahr"
  • VM Driver (e.g. cat ~/.minikube/machines/minikubeVM/config.json | grep DriverName): "DriverName": "virtualbox"
  • Docker version (e.g. docker -v): Docker version 1.11.2

What happened:
When I start minikube behind a proxy even if a use this command:
$ minikube start --docker-env HTTP_PROXY=http://$YOURPROXY:PORT \ --docker-env HTTPS_PROXY=https://$YOURPROXY:PORT

When running:
$ kubectl get nodes
What I get is:
Unable to connect to the server: Service Unavailable

What I get when starting minikube:
Starting local Kubernetes cluster...
Kubernetes is available at https://192.168.99.100:8443.
Kubectl is now configured to use the cluster.

I run $ minikube ssh and there is no proxy set.

kinbug

Most helpful comment

Following worked for me (in addition to the above steps)

# export no_proxy=$no_proxy,$(minikube ip)
# export NO_PROXY=$no_proxy,$(minikube ip)

# kubectl run hello-minikube --image=gcr.io/google_containers/echoserver:1.4 --port=8443                                                                                              
deployment "hello-minikube" created

All 24 comments

Any news about this issue? @dlorenc - can you assist here?

Sorry for the delay. @AndreeaDora , what did you check when you ran minikube ssh?

Could you attach the output of:
minikube ssh cat /var/lib/boot2docker/profile

The environment variables you set should be in that file.

Ah, it looks like we might have a bug in that flag. The values look like they are ignored if you run minikube start and the machine is already running. Try a minikube delete first, then re-run the command.

523 is working on fixing this in the general case.

I did the steps you suggested and I still get "Unable to connect to the server: Service Unavailable".
When I ran minikube ssh I checked the proxy, if it was set or not.

Sorry for the delay again here. If you do:

minikube delete
then:
minikube start --docker-env HTTP_PROXY=http://$YOURPROXY:PORT \ --docker-env HTTPS_PROXY=https://$YOURPROXY:PORT

and then run:
minikube ssh cat /var/lib/boot2docker/profile you should see the variables you passed in. Do you see anything there?

@AndreeaDora ping, any chance you could try out those commands?

@dlorenc I apologize for the delayed response. I run the minikube start --docker-env HTTP_PROXY=http://$YOURPROXY:PORT \ --docker-env HTTPS_PROXY=https://$YOURPROXY:PORT comand and got this response
Starting local Kubernetes cluster... E1010 10:05:57.150903 5991 start.go:85] Error starting host: Error creating host: Error creating machine: Error checking the host: Error checking and/or regenerating the certs: There was an error validating certificates for host "192.168.99.100:2376": dial tcp 192.168.99.100:2376: i/o timeout You can attempt to regenerate them using 'docker-machine regenerate-certs [name]'. Be advised that this will trigger a Docker daemon restart which will stop running containers. . Retrying. Kubectl is now configured to use the cluster.
After that I run: minikube ssh cat /var/lib/boot2docker/profile and got:
`EXTRA_ARGS='
--label provider=virtualbox

'
CACERT=/var/lib/boot2docker/ca.pem
DOCKER_HOST='-H tcp://0.0.0.0:2376'
DOCKER_STORAGE=aufs
DOCKER_TLS=auto
SERVERKEY=/var/lib/boot2docker/server-key.pem
SERVERCERT=/var/lib/boot2docker/server.pem

export "HTTP_PROXY=value_of_proxy"`

Btw: I had to use

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

instead of uppercase-letters HTTP_PROXY

@sebastianwoinar even if I set the http_proxy to lowercase letters i get the same issue as the one mentioned above, Unable to connect to the server: Service Unavailable.

I have faced the same issue here, any news?
@sebastianwoinar, I also tried your approach, sadly it didn't work, these are the commands that I entered:

minikube delete

  Deleting local Kubernetes cluster...
  Machine deleted.

env | grep -i proxy

  ftp_proxy=http://proxy....~hidden~.....com:8088
  http_proxy=http://proxy....~hidden~.....com:8088
  https_proxy=http://proxy....~hidden~.....com:8088

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

  Starting local Kubernetes cluster...
  Kubectl is now configured to use the cluster

kubectl config use-context minikube.

  switched to context "minikube".

kubectl get nodes

  Unable to connect to the server: Service Unavailable

@dlorenc, @sebastianwoinar - any news about this, can u you suggest what's wrong here?
thanks in advance :-)

@gustavo-hp Can you post the output of these commands?

minikube logs

and

minikube ssh -- cat /var/lib/boot2docker/profile

Following worked for me (in addition to the above steps)

# export no_proxy=$no_proxy,$(minikube ip)
# export NO_PROXY=$no_proxy,$(minikube ip)

# kubectl run hello-minikube --image=gcr.io/google_containers/echoserver:1.4 --port=8443                                                                                              
deployment "hello-minikube" created

I'm having the same issue. I tried checking the profile settings but it seems that this is not an existing file.

When I run minikube ssh -- cat /var/lib/boot2docker/profile

I get:

cat: can't open '/var/lib/boot2docker/profile': No such file or directory

This is the content of the boot2docker:

minikube ssh -- ls /var/lib/boot2docker/

etc
userdata.tar

Thoughts?

Never mind. adding the minikube ip to no_proxy does solve the problem.

I run the command: $ minikube start --docker-env HTTP_PROXY=http://$YOURPROXY:PORT \ --docker-env HTTPS_PROXY=https://$YOURPROXY:PORT with the new version of minikube and now it's working. Thank you!

I have the same problem and i tried the above solutions

`

export no_proxy=$no_proxy,$(minikube ip)

export NO_PROXY=$no_proxy,$(minikube ip)

`
This works for me.

hi~
I have meet the same problem,I tried the above but not resolve.

Environment:
ubuntu16.10 4.8.0-41-generic
docker-17.03
minikube 0.23
shadowsocks+polipo

In docker ,I set proxy as follows:

$ cat /etc/systemd/system/docker.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=http://localhost:8123/" "HTTPS_PROXY=https://localhost:8123/" "NO_PROXY=172.16.1.110"

first,I do minikube delete
Before minikube start,I command

 export http_proxy=http://localhost:8123
 export https_proxy=http://localhost:8123
 export NO_PROXY=192.168.99.100

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

and

export no_proxy=$no_proxy,$(minikube ip)
export NO_PROXY=$no_proxy,$(minikube ip)

minikube logs``as follows

Nov 23 08:21:43 minikube localkube[3147]: E1123 08:21:43.696316 3147 kuberuntime_sandbox.go:54] CreatePodSandbox for pod "kube-addon-manager-minikube_kube-system(9831e93c3188555873fdb49f43198eef)" failed: rpc error: code = Unknown desc = failed pulling image "gcr.io/google_containers/pause-amd64:3.0": Error response from daemon: Get https://gcr.io/v2/: proxyconnect tcp: dial tcp 127.0.0.1:8123: getsockopt: connection refused
Nov 23 08:21:43 minikube localkube[3147]: E1123 08:21:43.696325 3147 kuberuntime_manager.go:632] createPodSandbox for pod "kube-addon-manager-minikube_kube-system(9831e93c3188555873fdb49f43198eef)" failed: rpc error: code = Unknown desc = failed pulling image "gcr.io/google_containers/pause-amd64:3.0": Error response from daemon: Get https://gcr.io/v2/: proxyconnect tcp: dial tcp 127.0.0.1:8123: getsockopt: connection refused
Nov 23 08:21:43 minikube localkube[3147]: E1123 08:21:43.696371 3147 pod_workers.go:182] Error syncing pod 9831e93c3188555873fdb49f43198eef ("kube-addon-manager-minikube_kube-system(9831e93c3188555873fdb49f43198eef)"), skipping: failed to "CreatePodSandbox" for "kube-addon-manager-minikube_kube-system(9831e93c3188555873fdb49f43198eef)" with CreatePodSandboxError: "CreatePodSandbox for pod \"kube-addon-manager-minikube_kube-system(9831e93c3188555873fdb49f43198eef)\" failed: rpc error: code = Unknown desc = failed pulling image \"gcr.io/google_containers/pause-amd64:3.0\": Error response from daemon: Get https://gcr.io/v2/: proxyconnect tcp: dial tcp 127.0.0.1:8123: getsockopt: connection refused"
Nov 23 08:21:46 minikube localkube[3147]: E1123 08:21:46.697262 3147 remote_runtime.go:92] RunPodSandbox from runtime service failed: rpc error: code = Unknown desc = failed pulling image "gcr.io/google_containers/pause-amd64:3.0": Error response from daemon: Get https://gcr.io/v2/: proxyconnect tcp: dial tcp 127.0.0.1:8123: getsockopt: connection refused

Does anyone have any idea of this error?

first, can you confirm your proxy works well?
second, it seems "HTTPS_PROXY=https://localhost:8123/" is not right, I think it should be "HTTPS_PROXY=http://localhost:8123/"

@Mashimiao thank you. Yes my proxy work well. I confirmed by curl http://www.google.com. And I've revised https_proxy error but it won't work. Also, what confused me is that the error occurs when I've specified --image-pull-policy=IfNotPresend...

@sandylss After some searching, I found this post
https://forums.docker.com/t/beginner-having-trouble-with-docker-behind-company-proxy/3968/6

Summary for the post is that, in the VM, localhost/127.0.0.1 is the VM itself. You should set an IP address that you can access from the VM to your host. There are several options supplied by the author and I only tried the IP address that is the default gateway for a NAT mode interface in VM which will forward the connections in VM to the host's 127.0.0.1. And the ip address is 10.0.2.2

This worked in Mac. For Linux replace "minikube-darwin-amd64" with minikube-linux version (which is minikube-linux-amd64). Also install kubectl accordingly (https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl).

$ minikube delete
$ rm -rf ~/.minikube

$ export http_proxy=<insert the proxy>
$ export https_proxy=<insert the proxy>
$ export ALL_PROXY=<insert the proxy> alias npcurl='curl --noproxy "*"'
$ export no_proxy=<insert the proxy>

$ curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.25.2/minikube-darwin-amd64
$ chmod +x minikube
$ sudo mv minikube /usr/local/bin/
$ brew install kubectl

$ minikube start --docker-env http_proxy=$http_proxy --docker-env https_proxy=$https_proxy --docker-env no_proxy=192.168.99.0/24

$ export no_proxy=$no_proxy,$(minikube ip)
$ export NO_PROXY=$no_proxy,$(minikube ip)
Was this page helpful?
0 / 5 - 0 ratings