what is the proper proxy settings for docker and kubernetes

5/3/2018

Behind the enterprise proxy,

what is the proper setting for kubernetes (and docker)?

  1. when set the http_proxy, https_proxy, no_proxy

export http_proxy="http://1.2.3.4:8080"

or

export http_proxy=http://1.2.3.4:8080

or

export http_proxy=1.2.3.4:8080

  1. Should I set capital environment variable like HTTP_PROXY ?

  2. When I set no_proxy,

export no_proxy=10.0.0.1,10.0.0.2,10.0.0.3

(all the kubernetes master and nodes )

or

export no_proxy=10.0.0.*

  1. Should I setting below file ?

    $ vi /etc/systemd/system/docker.service.d/http-proxy.conf [Service] Environment="HTTP_PROXY=http://1.2.3.4:8080" "HTTPS_PROXY=http://1.2.3.4:8080" "NO_PROXY=127.0.0.1,localhost,10.0.0.1,10.0.0.2,10.0.0.3"

In this file, applied same rule with above question?

  1. any other considerations?

Thanks inadvance.

-- hokwang
docker
kubernetes
proxy

1 Answer

5/3/2018

We always include the scheme in our environment variables.

/etc/profile.d/proxy.sh:

#!/bin/bash
export http_proxy=http://<proxy>:3128
export https_proxy=$http_proxy
export no_proxy=169.254.169.254,localhost,127.0.0.1
export HTTP_PROXY=$http_proxy
export HTTPS_PROXY=$https_proxy
export NO_PROXY=$no_proxy

/etc/systemd/system/docker.service.d/proxy.conf:

[Service]
Environment="HTTPS_PROXY=https://<proxy>:3128/" "HTTP_PROXY=http://<proxy>:3128/"
-- Valdis R
Source: StackOverflow