node节点注册提示:failed to get config map: Unauthorized
提示如下:
[root@node1 ~]# kubeadm join 10.5.1.10:6443 --token llilpc.9je7qvdn7l4sygoo --discovery-token-ca-cert-hash sha256:a82baf34d02c5338c6c7c8e9234316dffecee709cea7cc76cda47c8e595f1745
W0122 19:36:32.447752 12903 join.go:346] [preflight] WARNING: JoinControlPane.controlPlane settings will be ignored when control-plane flag is not set.
[preflight] Running pre-flight checks
[preflight] Reading configuration from the cluster...
[preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -oyaml'
error execution phase preflight: unable to fetch the kubeadm-config ConfigMap: failed to get config map: Unauthorized
To see the stack trace of this error execute with --v=5 or higher
错误原因,token令牌失效,解决方法:
在master节点执行下面的命令
sudo kubeadm token create
然后再执行下面的命令重新生成注册令牌
sudo kubeadm token create --print-join-command
然后杀死node节点所有K8S相关的进程再注册一次即可
重新加入master节点提示error execution phase preflight: [preflight] Some fatal errors occurred
[root@node1 ~]# kubeadm join 10.5.1.5:6443 --token 1a8fot.izehoikcbfm6vcj6 --discovery-token-ca-cert-hash sha256:41498e76da4b483ec99963948303e3df1d0a4308bb096d33f77d6f8f42e53e63
W0203 17:56:00.454059 11793 join.go:346] [preflight] WARNING: JoinControlPane.controlPlane settings will be ignored when control-plane flag is not set.
[preflight] Running pre-flight checks
error execution phase preflight: [preflight] Some fatal errors occurred:
[ERROR FileAvailable--etc-kubernetes-kubelet.conf]: /etc/kubernetes/kubelet.conf already exists
[ERROR FileAvailable--etc-kubernetes-pki-ca.crt]: /etc/kubernetes/pki/ca.crt already exists
[preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`
To see the stack trace of this error execute with --v=5 or higher
解决办法:删除相关残留文件
rm -f /etc/kubernetes/kubelet.conf #删除k8s配置文件
rm -f /etc/kubernetes/pki/ca.crt #删除K8S证书
然后重新加入
验证一下:
端口占用提示:[ERROR Port-10250]: Port 10250 is in use
解决办法:查看占用进程,然后杀掉,再加入
安装相关工具(-q:静默安装)
sudo yum install -y net-tools -q
然后查看端口
netstat -ntpl | grep 10250
可以看出,是K8S占用了,那就尝试重启服务看看能不能解决
此时,端口已经不在使用了,然后重新加入
加入master提示:error execution phase kubelet-start: error uploading crisocket: timed out waiting for the condition
#关闭swap交换
swapoff -a
#重置K8S配置
kubeadm reset
#重置配置,重启服务
systemctl daemon-reload&&systemctl restart docker kubelet
#删除配置文件
rm -rf $HOME/.kube/config
#更新iptables规则
iptables -F && iptables -t nat -F && iptables -t mangle -F && iptables -X
引用:K8S问题汇总
所有评论(0)