How to use proxy in Minikube on Ubuntu VM?

巧了我就是萌 提交于 2021-02-19 05:32:37

问题


On an Ubuntu VM (running on Windows) I would like to install Minikube. My PC in running behind a corporate proxy. Using Proxifier I manage to access Internet and run Docker on Ubuntu. Unfortunately it looks like Minikube can't reach the internet...

minikube start
Starting local Kubernetes v1.9.4 cluster...
Starting VM...
Downloading Minikube ISO

The ISO can't be downloaded but it runs into a TLS handshake timeout...


回答1:


You mentioned you could establish proxy using Proxifier. So, you could possibly try something like this to force Minikube use Proxifier proxy as well

export NO_PROXY="$NO_PROXY,192.168.0.0/16" # set the no_proxy env variable in the current shell.
minikube start --docker-env "HTTPS_PROXY=http://proxy:808" --docker-env "HTTP_PROXY=http://proxy:808" --docker-env "NO_PROXY=localhost,127.0.0.1,192.168.0.0/16" # start minikube and pass the same no_proxy setting to docker

Specifying 192.168.0.0/16 as the range of ipaddresses that shouldn't go through the proxy as this is the range (I think) that minikube generate it's IP addresses in (and I'm certain that I don't have anything else in that range)

More details is available on Minikube’s Github issue https://github.com/kubernetes/minikube/issues/2706




回答2:


Minikube 1.0 (March 2019) now comes with PR 3834: "Automatically propagate proxy environment variables to docker env"

Currently, our documentation recommends that users use:

minikube start \
--docker-env=HTTP_PROXY=$HTTP_PROXY \
--docker-env HTTPS_PROXY=$HTTPS_PROXY \
 --docker-env NO_PROXY=$NO_PROXY

This makes the setting of --docker-env automatic if the environment variables are set.

Implemented in PR 3835: "Plumb HTTP proxy configuration from host into VM environment"

Detect system proxy configuration from environment, and plumb them into the docker env and /etc/environment within the VM by default.



来源:https://stackoverflow.com/questions/53894597/how-to-use-proxy-in-minikube-on-ubuntu-vm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!