未验证 提交 6dadf415 编写于 作者: T Thomas Strömberg 提交者: GitHub

Add detailed examples for macOS, Linux, Windows

上级 3426326e
## Using Minikube with an HTTP Proxy
Minikube creates a Virtual Machine that includes Kubernetes and a Docker daemon.
When Kubernetes attempts to schedule containers using Docker, the Docker daemon may require external network access to pull containers.
minikube requires access to the internet via HTTP, HTTPS, and DNS protocols. If a HTTP proxy is required to access the internet, you may need to pass the proxy connection information to both minikube and Docker using environment variables:
If you are behind an HTTP proxy, you may need to supply Docker with the proxy settings.
To do this, pass the required environment variables as flags during `minikube start`.
* HTTP_PROXY - The URL to your HTTP proxy
* HTTPS_PROXY - The URL to your HTTPS proxy
* NO_PROXY - A comma-separated list of hosts which should not go through the proxy.
For example:
The NO_PROXY variable here is important: Without setting it, minikube may not be able to access resources within the VM. minikube has two important ranges of internal IP's:
* 192.168.0.0/12: Used by the minikube VM. Configurable for some hypervisors via `--host-only-cidr`
* 10.96.0.0/12: Used by service cluster IP's. Configurable via `--service-cluster-ip-range`
## Example Usage
### macOS and Linux
```shell
$ minikube start --docker-env=HTTP_PROXY=http://$YOURPROXY:PORT \
--docker-env=HTTPS_PROXY=https://$YOURPROXY:PORT
```
export HTTP_PROXY=http://<proxy hostname:port>
export HTTPS_PROXY=https://<proxy hostname:port>
export NO_PROXY=localhost,127.0.0.1,10.96.0.0/12,192.168.0.0/16
minikube start --docker-env=HTTP_PROXY=$HTTP_PROXY --docker-env HTTPS_PROXY=$HTTPS_PROXY
```
To make the exported variables permanent, consider adding the declarations to ~/.bashrc or wherever your user-set environment variables are stored.
If your Virtual Machine address is 192.168.99.100, then chances are your proxy settings will prevent kubectl from directly reaching it.
To by-pass proxy configuration for this IP address, you should modify your no_proxy settings. You can do so with:
### Windows
```shell
$ export no_proxy=$no_proxy,$(minikube ip)
```
set HTTP_PROXY=http://<proxy hostname:port>
set HTTPS_PROXY=https://<proxy hostname:port>
set NO_PROXY=localhost,127.0.0.1,10.96.0.0/12,192.168.0.0/16
minikube start --docker-env=HTTP_PROXY=$HTTP_PROXY --docker-env HTTPS_PROXY=$HTTPS_PROXY --docker-env NO_PROXY=$NO_PROXY
```
To set these environment variables permanently, consider adding these to your [system settings](https://support.microsoft.com/en-au/help/310519/how-to-manage-environment-variables-in-windows-xp) or using [setx](https://stackoverflow.com/questions/5898131/set-a-persistent-environment-variable-from-cmd-exe)
## Additional Information
- [Configure Docker to use a proxy server](https://docs.docker.com/network/proxy/)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册