在公司代理后面时 OpenShift import-image 失败

OpenShift import-image fails when behind corporate proxy

当我运行

oc import-image centos:7 --confirm true

我得到

The import completed with errors.

Name:                   centos
Namespace:              pd-kube-ci
Created:                Less than a second ago
Labels:                 <none>
Annotations:            openshift.io/image.dockerRepositoryCheck=2018-12-27T21:00:26Z
Docker Pull Spec:       docker-registry.default.svc:5000/pd-kube-ci/centos
Image Lookup:           local=false
Unique Images:          0
Tags:                   1

7
  tagged from centos:7

  ! error: Import failed (InternalError): Internal error occurred: Get https://registry-1.docker.io/v2/: proxyconnect tcp: EOF
      Less than a second ago

error: tag 7 failed: Internal error occurred: Get https://registry-1.docker.io/v2/: proxyconnect tcp: EOF

我这辈子都找不到 proxyconnect tcp: EOF 的来源。在 OpenShift/Kubernetes 来源中的任何地方都找不到它。 Google 对此几乎一无所知。

我还验证了我可以从每个节点(包括主节点和基础节点)docker pull centos。仅当 openshift 尝试拉取该图像时。

有什么想法吗?

事实证明这是我们 openshift_https_proxy ansible var 中的错误配置。具体来说,我们有:

openshift_https_proxy=https://proxy.mycompany.com:8443

我们应该有

openshift_https_proxy=http://proxy.mycompany.com:8443

要解决此问题,我们必须在主节点上编辑 /etc/origin/master/master.env 并在所有节点上编辑 /etc/sysconfig/docker,然后根据 Working with HTTP Proxies 文档重新启动。