From 6dadf415baacf084c90d0dedf9b50acc2d65e5e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Str=C3=B6mberg?= Date: Tue, 19 Feb 2019 15:36:12 -0800 Subject: [PATCH] Add detailed examples for macOS, Linux, Windows --- docs/http_proxy.md | 45 +++++++++++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/docs/http_proxy.md b/docs/http_proxy.md index 24cb82c14..a03613585 100644 --- a/docs/http_proxy.md +++ b/docs/http_proxy.md @@ -1,21 +1,42 @@ ## 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:// +export HTTPS_PROXY=https:// +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:// +set HTTPS_PROXY=https:// +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/) -- GitLab