1. 程式人生 > 實用技巧 >failed to pull image k8s.gcr.io/kube-controller-manage

failed to pull image k8s.gcr.io/kube-controller-manage

root@ubuntu:~# kubeadm init --kubernetes-version=v1.18.1  --pod-network-cidr=10.244.0.0/16 --apiserver-advertise-address=10.10.16.82  --cri-socket /run/containerd/containerd.sock 
W1014 12:00:18.348953   26276 configset.go:202] WARNING: kubeadm cannot validate component configs for API groups [kubelet.config.k8s.io kubeproxy.config.k8s.io]
[init] Using Kubernetes version: v1.
18.1 [preflight] Running pre-flight checks [preflight] Pulling images required for setting up a Kubernetes cluster [preflight] This might take a minute or two, depending on the speed of your internet connection [preflight] You can also perform this action in beforehand using 'kubeadm config images pull
' error execution phase preflight: [preflight] Some fatal errors occurred: [ERROR ImagePull]: failed to pull image k8s.gcr.io/kube-apiserver:v1.18.1: output: time="2020-10-14T12:02:48+08:00" level=fatal msg="pulling image failed: rpc error: code = Unknown desc = failed to pull and unpack image \"k8s.gcr.io/kube-apiserver:v1.18.1\": failed to resolve reference \"k8s.gcr.io/kube-apiserver:v1.18.1\": failed to do request: Head https://k8s.gcr.io/v2/kube-apiserver/manifests/v1.18.1: dial tcp 74.125.204.82:443: i/o timeout
" , error: exit status 1 [ERROR ImagePull]: failed to pull image k8s.gcr.io/kube-controller-manager:v1.18.1: output: time="2020-10-14T12:05:18+08:00" level=fatal msg="pulling image failed: rpc error: code = Unknown desc = failed to pull and unpack image \"k8s.gcr.io/kube-controller-manager:v1.18.1\": failed to resolve reference \"k8s.gcr.io/kube-controller-manager:v1.18.1\": failed to do request: Head https://k8s.gcr.io/v2/kube-controller-manager/manifests/v1.18.1: dial tcp 108.177.97.82:443: i/o timeout" , error: exit status 1 [ERROR ImagePull]: failed to pull image k8s.gcr.io/kube-scheduler:v1.18.1: output: time="2020-10-14T12:07:48+08:00" level=fatal msg="pulling image failed: rpc error: code = Unknown desc = failed to pull and unpack image \"k8s.gcr.io/kube-scheduler:v1.18.1\": failed to resolve reference \"k8s.gcr.io/kube-scheduler:v1.18.1\": failed to do request: Head https://k8s.gcr.io/v2/kube-scheduler/manifests/v1.18.1: dial tcp 64.233.188.82:443: i/o timeout" , error: exit status 1 [ERROR ImagePull]: failed to pull image k8s.gcr.io/kube-proxy:v1.18.1: output: time="2020-10-14T12:10:18+08:00" level=fatal msg="pulling image failed: rpc error: code = Unknown desc = failed to pull and unpack image \"k8s.gcr.io/kube-proxy:v1.18.1\": failed to resolve reference \"k8s.gcr.io/kube-proxy:v1.18.1\": failed to do request: Head https://k8s.gcr.io/v2/kube-proxy/manifests/v1.18.1: dial tcp 74.125.204.82:443: i/o timeout" , error: exit status 1 [ERROR ImagePull]: failed to pull image k8s.gcr.io/pause:3.2: output: time="2020-10-14T12:12:48+08:00" level=fatal msg="pulling image failed: rpc error: code = Unknown desc = failed to pull and unpack image \"k8s.gcr.io/pause:3.2\": failed to resolve reference \"k8s.gcr.io/pause:3.2\": failed to do request: Head https://k8s.gcr.io/v2/pause/manifests/3.2: dial tcp 74.125.204.82:443: i/o timeout" , error: exit status 1 [ERROR ImagePull]: failed to pull image k8s.gcr.io/etcd:3.4.3-0: output: time="2020-10-14T12:15:18+08:00" level=fatal msg="pulling image failed: rpc error: code = Unknown desc = failed to pull and unpack image \"k8s.gcr.io/etcd:3.4.3-0\": failed to resolve reference \"k8s.gcr.io/etcd:3.4.3-0\": failed to do request: Head https://k8s.gcr.io/v2/etcd/manifests/3.4.3-0: dial tcp 108.177.125.82:443: i/o timeout" , error: exit status 1 [ERROR ImagePull]: failed to pull image k8s.gcr.io/coredns:1.6.7: output: time="2020-10-14T12:17:49+08:00" level=fatal msg="pulling image failed: rpc error: code = Unknown desc = failed to pull and unpack image \"k8s.gcr.io/coredns:1.6.7\": failed to resolve reference \"k8s.gcr.io/coredns:1.6.7\": failed to do request: Head https://k8s.gcr.io/v2/coredns/manifests/1.6.7: dial tcp 74.125.204.82:443: i/o timeout" , error: exit status 1 [preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...` To see the stack trace of this error execute with --v=5 or higher

docker pull mirrorgcrio/pause-arm64:3.2
docker pull mirrorgcrio/kube-proxy-arm64:v1.18.1
docker pull mirrorgcrio/kube-controller-manager-arm64:v1.18.1
docker pull mirrorgcrio/kube-apiserver-arm64:v1.18.1
docker pull mirrorgcrio/kube-scheduler-arm64:v1.18.1
docker pull mirrorgcrio/etcd-arm64:3.4.3-0
docker pull coredns/coredns:coredns-arm64


docker tag mirrorgcrio/kube-apiserver-arm64:v1.18.1 k8s.gcr.io/kube-apiserver:v1.18.1
docker tag mirrorgcrio/kube-scheduler-arm64:v1.18.1 k8s.gcr.io/kube-scheduler:v1.18.1
docker tag mirrorgcrio/kube-controller-manager-arm64:v1.18.1 k8s.gcr.io/kube-controller-manager:v1.18.1
docker tag mirrorgcrio/kube-proxy-arm64:v1.18.1 k8s.gcr.io/kube-proxy:v1.18.1
docker tag mirrorgcrio/pause-arm64:3.2 k8s.gcr.io/pause:3.2
docker tag mirrorgcrio/etcd-arm64:3.4.3-0 k8s.gcr.io/etcd:3.4.3-0
docker tag coredns/coredns:coredns-arm64 k8s.gcr.io/coredns:1.6.7

apt-get install kubeadm=1.18.1-00 kubectl=1.18.1-00 kubelet=1.18.1-00
kubeadm init --kubernetes-version=v1.18.1 --pod-network-cidr=10.244.0.0/16 --apiserver-advertise-address=14.14.18.6

------------------------------------------------------------------------
flannel映象:
docker pull registry.cn-shanghai.aliyuncs.com/yijindami/flannel:v0.12.0-amd64
docker pull registry.cn-shanghai.aliyuncs.com/yijindami/flannel:v0.12.0-arm64
docker pull registry.cn-shanghai.aliyuncs.com/yijindami/flannel:v0.12.0-arm
docker pull registry.cn-shanghai.aliyuncs.com/yijindami/flannel:v0.12.0-ppc64le
docker pull registry.cn-shanghai.aliyuncs.com/yijindami/flannel:v0.12.0-s390x


docker tag registry.cn-shanghai.aliyuncs.com/yijindami/flannel:v0.12.0-amd64 quay.io/coreos/flannel:v0.12.0-amd64
docker tag registry.cn-shanghai.aliyuncs.com/yijindami/flannel:v0.12.0-arm64 quay.io/coreos/flannel:v0.12.0-arm64
docker tag registry.cn-shanghai.aliyuncs.com/yijindami/flannel:v0.12.0-arm quay.io/coreos/flannel:v0.12.0-arm
docker tag registry.cn-shanghai.aliyuncs.com/yijindami/flannel:v0.12.0-ppc64le quay.io/coreos/flannel:v0.12.0-ppc64le
docker tag registry.cn-shanghai.aliyuncs.com/yijindami/flannel:v0.12.0-s390x quay.io/coreos/flannel:v0.12.0-s390x

kubectl create -f kube-flannel.yml

解決方案: docker.io倉庫對google的容器做了映象,可以通過下列命令下拉取相關映象:

docker pull mirrorgooglecontainers/kube-apiserver-amd64:v1.11.3
docker pull mirrorgooglecontainers/kube-controller-manager-amd64:v1.11.3
docker pull mirrorgooglecontainers/kube-scheduler-amd64:v1.11.3
docker pull mirrorgooglecontainers/kube-proxy-amd64:v1.11.3
docker pull mirrorgooglecontainers/pause:3.1
docker pull mirrorgooglecontainers/etcd-amd64:3.2.18
docker pull coredns/coredns:1.1.3
 

版本資訊需要根據實際情況進行相應的修改。通過docker tag命令來修改映象的標籤:

docker tag docker.io/mirrorgooglecontainers/kube-proxy-amd64:v1.11.3 k8s.gcr.io/kube-proxy-amd64:v1.11.3
docker tag docker.io/mirrorgooglecontainers/kube-scheduler-amd64:v1.11.3 k8s.gcr.io/kube-scheduler-amd64:v1.11.3
docker tag docker.io/mirrorgooglecontainers/kube-apiserver-amd64:v1.11.3 k8s.gcr.io/kube-apiserver-amd64:v1.11.3
docker tag docker.io/mirrorgooglecontainers/kube-controller-manager-amd64:v1.11.3 k8s.gcr.io/kube-controller-manager-amd64:v1.11.3
docker tag docker.io/mirrorgooglecontainers/etcd-amd64:3.2.18  k8s.gcr.io/etcd-amd64:3.2.18
docker tag docker.io/mirrorgooglecontainers/pause:3.1  k8s.gcr.io/pause:3.1
docker tag docker.io/coredns/coredns:1.1.3  k8s.gcr.io/coredns:1.1.3