使用下面的命令创建 kubernetes 集群
kubeadm init \
--control-plane-endpoint "k8s-api:6443" --upload-certs \
--image-repository registry.cnblogs.com \
--pod-network-cidr=192.168.0.0/16
创建过程中出现下面的错误,请问如何解决?
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[kubelet-start] Starting the kubelet
error: error execution phase wait-control-plane: cannot obtain client without bootstrap: could not bootstrap the admin user in file admin.conf: unable to create ClusterRoleBinding: context deadline exceeded
To see the stack trace of this error execute with --v=5 or higher
是 sandbox 的镜像拉取失败引起的,默认用的镜像是 registry.k8s.io/pause:3.10.2
在 /etc/containerd/config.toml 中将
[plugins.'io.containerd.cri.v1.images'.pinned_images]
sandbox = 'registry.cnblogs.com/pause:3.10.2'
改为私有镜像仓库的镜像地址即可解决
[plugins.'io.containerd.cri.v1.images'.pinned_images]
sandbox = 'registry.k8s.io/pause:3.10.2'