hokwang
hokwang

Reputation: 837

what is the proper proxy settings for docker and kubernetes

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.

Upvotes: 4

Views: 2069

Answers (2)

Rasmitha J
Rasmitha J

Reputation: 31

we will add the proxy in both /etc/environment file and docker.service file

In /etc/environment

export http_proxy=http://10.169.33.81:8080/

export https_proxy=http://10.169.33.81:8080/
export no_proxy="127.0.0.1,localhost,(added all the worker node server ip)"
export NO_PROXY=$no_proxy

In docker.service file

Environment="HTTP_PROXY=http://10.x.x.x:8080/"
Environment="HTTPS_PROXY=http://10.x.x.x:8080/"
Environment="NO_PROXY=127.0.0.1,0.0.0.0"

Upvotes: 0

Valdis R
Valdis R

Reputation: 2115

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/"

Upvotes: 4

Related Questions