Solve failed to pull image from “k8s.gcr.io “

interbeing
Mar 31, 2021

when try to pull image from k8s.gcr.io. it always failed with error messages like below although I have http_proxy configured.

failed to pull image “k8s.gcr.io/kube-apiserver:v1.17.17”: output: Error response from daemon: Get https://k8s.gcr.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
, error: exit status 1

Couple things need to be fixed to solve this issue.

i@master-node:/etc/systemd/system$ sudo mkdir -p /etc/systemd/system/docker.service.d
i@master-node:/etc/systemd/system$ sudo touch /etc/systemd/system/docker.service.d/proxy.conf
i@master-node:/etc/systemd/system$ sudo chmod 777 /etc/systemd/system/docker.service.d/proxy.conf
i@master-node:/etc/systemd/system$ sudo vi
/etc/systemd/system/docker.service.d/proxy.conf
i@master-node:/etc/systemd/system/docker.service.d$ cat proxy.conf
[Service]
Environment="HTTP_PROXY=http://127.0.0.1:8123/"
Environment="HTTPS_PROXY=http://127.0.0.1:8123/"
i@master-node:/etc/systemd/system$ sudo systemctl daemon-reload
i@master-node:/etc/systemd/system$ sudo systemctl restart docker
i@master-node:/etc/systemd/system$ sudo systemctl show — property=Environment docker
Environment=HTTP_PROXY=http://127.0.0.1:8123/ HTTPS_PROXY=http://127.0.0.1:8123/

2. DNS name

--

--