【问题标题】:what is the proper proxy settings for docker and kubernetesdocker 和 kubernetes 的正确代理设置是什么
【发布时间】:2018-10-13 09:21:32
【问题描述】:

企业代理背后,

kubernetes(和 docker)的正确设置是什么?

  1. 设置http_proxy、https_proxy、no_proxy时

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

export http_proxy=http://1.2.3.4:8080

export http_proxy=1.2.3.4:8080

  1. 我应该设置像 HTTP_PROXY 这样的大写环境变量吗?

  2. 当我设置 no_proxy 时,

export no_proxy=10.0.0.1,10.0.0.2,10.0.0.3

(所有 Kubernetes 主节点和节点)

export no_proxy=10.0.0.*

  1. 我应该设置下面的文件吗?

    $ vi /etc/systemd/system/docker.service.d/http-proxy.conf [服务] 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"

在这个文件中,是否应用了与上述问题相同的规则?

  1. 还有其他注意事项吗?

谢谢你。

【问题讨论】:

    标签: docker proxy kubernetes


    【解决方案1】:

    我们总是将方案包含在我们的环境变量中。

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

    【讨论】:

      【解决方案2】:

      我们将在 /etc/environment 文件和 docker.service 文件中添加代理

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

      在 docker.service 文件中

      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"
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2015-02-11
        • 2022-01-10
        • 2017-10-28
        • 1970-01-01
        • 1970-01-01
        • 2014-04-20
        • 2010-10-30
        相关资源
        最近更新 更多