kubeadm init cannot successfully initialize the cluster ---- continuous update


update_time:2023-04-19 23:17

一、kubectl get nodes ERROR 8080 connection refused

solution

# 添加环境变量
echo "export KUBECONFIG=/etc/kubernetes/admin.conf" >> /etc/profile
source /etc/profile
systemctl restart kubelet
kubeadm reset -f

二、kubectl get nodes ERROR 6443 connection refused

kubeadm init failed to initialize the cluster successfully, and at the same time kubectl get nodes got an error message and could not connect to xxxx:6443

Troubleshooting

# 查看具体报错信息
cat /var/log/messages |grep kube-apiserver

solution

Prompt that the pause:3.6 image cannot be pulled

Option One

pause_version=`kubeadm config images list|grep pause|awk -F '/' '{print $NF}'`
containerd config default > /etc/containerd/config.toml
sed -i 's/registry.k8s.io\/pause:3.6/registry.aliyuncs.com\/google_containers\/:'"${pause_version}"'/' /etc/containerd/config.toml
sed -i 's/SystemdCgroup = false/SystemdCgroup = true/' /etc/containerd/config.toml
systemctl restart containerd kubelet
kubeadm reset -f

Option II

pause_version=`kubeadm config images list|grep pause|awk -F '/' '{print $NF}'`
echo "--pod-infra-container-image=registry.aliyuncs.com/google_containers:${pause_version}" >> /etc/sysconfig/kubelet
systemctl restart kubelet

Guess you like

Origin blog.csdn.net/fly1574/article/details/130233528