第一个:

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

解决办法:查看占用进程,然后杀掉,再加入

 

 

sudo yum install -y net-tools -q    #安装相关工具(-q:静默安装)

  然后查看端口

netstat -ntpl | grep 10250

  

 

 可以看出,是K8S占用了,那就尝试重启服务看看能不能解决

 

 此时,端口已经不在使用了,然后重新加入

 

加入成功,问题解决!

第四个:

  应用yaml文件提示:unknown field "NodePort" in io.k8s.api.core.v1.ServicePort; if you choose to ignore these errors, turn validation off with --validate=false

 

 

错误原因,yaml参数填写错误,在这里我的是NodePort这段写错了,正确的nodeport模式指定具体值时应首字母小写

 

 一开始写成了“NodePort”,后来改成“nodePort”之后问题解决

 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

 

第五个:

加入master提示:error execution phase kubelet-start: error uploading crisocket: timed out waiting for the condition

解决办法:

swapoff -a    #关闭swap交换
kubeadm reset  #重置K8S配置
systemctl daemon-reload&&systemctl restart docker kubelet  #重置配置,重启服务

  

rm -rf $HOME/.kube/config  #删除配置文件

 

iptables -F && iptables -t nat -F && iptables -t mangle -F && iptables -X  #更新iptables规则

 最后重新加入即可,至此,问题解决!

 第六个

  加入master提示:[ERROR FileExisting-nsenter]: nsenter not found in system path

node节点信息如下:

 

 

 

 

 

 master节点信息为:

Centos7

 

 

 

 解决方法如下:

rm -f util-linux-2.25.tar.gz*&&wget https://k8s-1252147235.cos.ap-chengdu.myqcloud.com/docker/util-linux-2.25.tar.gz
mkdir -p /cx/&&tar -zxvf util-linux-2.25.tar.gz -C /cx/
sudo apt-get install autopoint autoconf libtool automake make
./configure --without-python --disable-all-programs --enable-nsenter --without-ncurses
make nsenter; cp nsenter /usr/local/bin

 

 可以看到,此时已经没有之前那个错误警告了,不过出现了新的问题-------------------------------------------emmmmmmmmmmmmm

 

第七个

加入master节点提示:/proc/sys/net/bridge/bridge-nf-call-iptables does not exist

解决办法如下:

modprobe br_netfilter&&echo 1 > /proc/sys/net/bridge/bridge-nf-call-iptables

 

 

posted on 2020-01-22 19:45  坐公交也用券  阅读(21539)  评论(1编辑  收藏  举报

// 这里是系统默认参数 // 开始添加背景音乐