kubeadm init无法成功初始化集群----持续更新中

2023-05-31 11:17:16 浏览数 (2)

kubeadm init无法成功初始化集群,connection refused 6443 update_time:2023-04-19 23:17

一、kubectl get nodes ERROR 8080 connection refused

解决方案

代码语言:javascript复制
# 添加环境变量
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 无法成功初始化集群,同时kubectl get nodes得到报错信息,无法连接到 xxxx:6443

问题排查

代码语言:javascript复制
# 查看具体报错信息
cat /var/log/messages |grep kube-apiserver

解决方案

提示无法拉去pause:3.6镜像

方案一
代码语言:javascript复制
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
方案二
代码语言:javascript复制
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

0 人点赞