简体   繁体   English

如何在 Ubuntu VM 上的 Minikube 中使用代理?

[英]How to use proxy in Minikube on Ubuntu VM?

On an Ubuntu VM (running on Windows) I would like to install Minikube.在 Ubuntu VM(在 Windows 上运行)上,我想安装 Minikube。 My PC in running behind a corporate proxy.我的电脑在公司代理后面运行。 Using Proxifier I manage to access Internet and run Docker on Ubuntu.使用 Proxifier 我设法访问互联网并在 Ubuntu 上运行 Docker。 Unfortunately it looks like Minikube can't reach the internet...不幸的是,Minikube 似乎无法访问互联网...

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...无法下载 ISO,但它遇到了 TLS 握手超时...

You mentioned you could establish proxy using Proxifier.您提到可以使用 Proxifier 建立代理。 So, you could possibly try something like this to force Minikube use Proxifier proxy as well所以,你可以尝试这样的事情来强制 Minikube 也使用 Proxifier 代理

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)指定192.168.0.0/16作为不应该通过代理的 ipaddresses 范围,因为这是 minikube 生成它的 IP 地址的范围(我认为)(我确定我没有其他任何东西那个范围)

More details is available on Minikube's Github issue https://github.com/kubernetes/minikube/issues/2706 Minikube 的 Github 问题上提供了更多详细信息https://github.com/kubernetes/minikube/issues/2706

Minikube 1.0 (March 2019) now comes with PR 3834 : "Automatically propagate proxy environment variables to docker env" Minikube 1.0 (2019 年 3 月)现在带有PR 3834 :“自动将代理环境变量传播到 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.如果设置了环境变量,这将使--docker-env的设置自动进行。

Implemented in PR 3835 : "Plumb HTTP proxy configuration from host into VM environment"PR 3835 中实现:“将 HTTP 代理配置从主机引入 VM 环境”

Detect system proxy configuration from environment, and plumb them into the docker env and /etc/environment within the VM by default.从环境中检测系统代理配置,默认情况下将它们连接到 VM 中的 docker env 和/etc/environment

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM