kubeadm init:failed to pull image registry.k8s.io/pause:3.6

错误信息:

Unfortunately,an error has occurred:
        timed out waiting for the condition

This error is likely caused by:
        - The kubelet is not running
        - The kubelet is unhealthy due to a misconfiguration of the node in some way (required cgroups disabled)

If you are on a systemd-powered system,you can try to troubleshoot the error with the following commands:
        - 'systemctl status kubelet'
        - 'journalctl -xeu kubelet'

Additionally,a control plane component may have crashed or exited when started by the container runtime.
To troubleshoot,list all containers using your preferred container runtimes CLI.
Here is one example how you may list all running Kubernetes containers by using crictl:
        - 'crictl --runtime-endpoint unix:///var/run/containerd/containerd.sock ps -a | grep kube | grep -v pause'
        Once you have found the failing container,you can inspect its logs with:
        - 'crictl --runtime-endpoint unix:///var/run/containerd/containerd.sock logs CONTAINERID'
couldn't initialize a Kubernetes cluster

查看出错原因:

journalctl -xeu kubelet | grep error

出错日志如下:

"Error syncing pod,skipping" err="failed to \"CreatePodSandbox\" for \"etcd-node1_kube-system(9de77c96e322a151c753f92a3e230dc0)\" with CreatePodSandboxError: \"Failed to create sandbox for pod \\\"etcd-node1_kube-system(9de77c96e322a151c753f92a3e230dc0)\\\": rpc error: code = DeadlineExceeded desc = failed to get sandbox image \\\"registry.k8s.io/pause:3.6\\\": failed to pull image \\\"registry.k8s.io/pause:3.6\\\": failed to pull and unpack image \\\"registry.k8s.io/pause:3.6\\\": failed to resolve reference \\\"registry.k8s.io/pause:3.6\\\": failed to do request: Head \\\"https://us-west2-docker.pkg.dev/v2/k8s-artifacts-prod/images/pause/manifests/3.6\\\": dial tcp 173.194.174.82:443: i/o timeout\"" pod="kube-system/etcd-node1" podUID=9de77c96e322a151c753f92a3e230dc0

出错原因分析:

拉取 registry.k8s.io/pause:3.6 镜像失败 导致sandbox 创建不了而报错

 解决方法:

# 生成 containerd 的默认配置文件

containerd config default > /etc/containerd/config.toml

# 查看 sandbox 的默认镜像仓库在文件中的第几行

cat /etc/containerd/config.toml | grep -n "sandbox_image"

# 使用 vim 编辑器 定位到 sandbox_image,将 仓库地址修改成 k8simage/pause:3.6

vim /etc/containerd/config.toml

sandbox_image = " registry.aliyuncs.com/google_containers/pause:3.6"

# 重启 containerd 服务

systemctl daemon-reload
systemctl restart containerd.service

# init

kubeadm init ......

相关文章

文章浏览阅读942次。kube-controller-manager 和 kubelet 是...
文章浏览阅读3.8k次。上篇文章详细介绍了弹性云混部的落地历...
文章浏览阅读897次。对于cpu来说,这种分配方式并不会有太大...
文章浏览阅读796次,点赞17次,收藏15次。只要在Service定义...
文章浏览阅读763次。但是此时如果配置成 NONE, 租户创建成功...
文章浏览阅读2.7k次,点赞2次,收藏13次。公司使用的是交老的...