1. kubeadm撤销操作
在Master节点上运行:
kubectl drain <node name> --delete-local-data --force --ignore-daemonsets
kubectl delete node <node name>
然后在需要移除的节点上,重置kubeadm的安装状态:
sudo kubeadm reset
如果你想重新配置集群,使用新的参数重新运行kubeadm init或者kubeadm join即可。
2.网络flannel插件镜像拉取不下 kube-flannel-ds-ckvrq 0/1 Init:ImagePullBackOff
image.png
解决办法:
1》 找国内镜像资源库
2》下载地址https://github.com/flannel-io/flannel/
下载自定版本到本地后上传到节点服务器
或者wget https://github.com/flannel-io/flannel/releases/download/v0.13.1-rc2/flanneld-v0.13.1-rc2-amd64.docker
docker load < flanneld-v0.13.1-rc2-amd64.docker
查看成功,tag 不一致
image.png
docker tag imageId REPOSITORY:TAG
image.png
完成后,查看pod状态,running
image.png
3. error execution phase preflight: unable to fetch the kubeadm-config ConfigMap: failed to get config map: Get https://master.k8s.io:16443/api/v1/namespaces/kube-system/configmaps/kubeadm-config?timeout=10s: dial tcp 192.168.1.204:16443: connect: connection refused
解决办法:重启节点服务器reboot。
4.The connection to the server master.k8s.io:16443 was refused - did you specify the right host or port?
5.克隆虚拟机之后,发现克隆出来的虚拟机网卡地址名变成了ens33
解决办法:
cd /etc/sysconfig/network-scripts/
修改网卡配置文件
MV ifcfg-xxxxx ifcfg-ens33
NAME=ens33
DEVICE=ens33
移除NetworkManger
systemctl stop NetworkManager
systemctl disable NetworkManager
刷新ens33
ip addr flush dev ens33
ifdown ens33
ifup ens33
6.运行的k8s集群,某天发现一个节点显示NotReady
kubectl get nodes
解决办法:
重启docker
systemctl daemon-reload
systemctl restart docker
重启kubelet
systemctl restart kubelet
7.加入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规则
8.2.删除节点
master上执行
kubectl drain k8s-node2 --delete-local-data --force --ignore-daemonsets
kubectl delete node k8s-node2
node2上执行
kubeadm reset
9 检查错误日志和服务状态
systemctl status docker
systemctl status kubelet
journalctl -f -u kubelet
kubelet logs
kubectl get events
kubectl get cs
10. 出现别人没出现过的错误
重新初始化,初始化记得用
kubeadmin reset
kubeadmin init 加特定参数
systemctl daemon-reload
systemctl restart docker
systemctl restart kubelet
11.重新生成 token
kubeadm token create --print-join-command
网友评论