kubeadm init [ERROR ImagePull]: failed to pull image registry.k8s.io 解决方法
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了kubeadm init [ERROR ImagePull]: failed to pull image registry.k8s.io 解决方法相关的知识,希望对你有一定的参考价值。
https://blog.itwk.cc
由于国内网络原因,kubeadm init部署集群会卡住不动,,报错如下: error execution phase preflight: [preflight] Some fatal errors occurred: [ERROR ImagePull]: failed to pull image registry.k8s.io/kube-apiserver:v1.25.6: output: E0124 00:28:25.369652 3299 remote_image.go:171] "PullImage from image service failed" err="rpc error: code = Unknown desc = Error response from daemon: Head "https://asia-east1-docker.pkg.dev/v2/k8s-artifacts-prod/images/kube-apiserver/manifests/v1.25.6": dial tcp 64.233.189.82:443: connect: connection refused" image="registry.k8s.io/kube-apiserver:v1.25.6" time="2023-01-24T00:28:25+08:00" level=fatal msg="pulling image: rpc error: code = Unknown desc = Error response from daemon: Head "https://asia-east1-docker.pkg.dev/v2/k8s-artifacts-prod/images/kube-apiserver/manifests/v1.25.6": dial tcp 64.233.189.82:443: connect: connection refused" , error: exit status 1
截图如下
解决方法
因为要下载K8s所需的Docker镜像文件,众所周知K8s是谷歌研发出来的,registry服务器在谷歌,国内连不上,所以这里我们要用阿里云镜像
运行kubeadm init时加上阿里云镜像的参数即可
such as
kubeadm init --kubernetes-version=v1.25.6 --pod-network-cidr=10.224.0.0/16 --apiserver-advertise-address=172.25.80.10 --cri-socket unix:///var/run/cri-dockerd.sock --image-repository=registry.aliyuncs.com/google_containers
最后添加--image-repository=registry.aliyuncs.com/google_containers
即可
以上是关于kubeadm init [ERROR ImagePull]: failed to pull image registry.k8s.io 解决方法的主要内容,如果未能解决你的问题,请参考以下文章
kubeadm工作原理-kubeadm init原理分析-kubeadm join原理分析
k8s部署init报错:[ERROR ImagePull]: failed to pull image k8s.gcr.io/coredns/coredns:v1.8.6: output: Error
Kubernetes Kubeadm init 与 join 原理分析
关于使用kubeadm reset命令对kubeadm init与kubeadm join操作后遇到报错的情况-进行恢复还原