k8s从节点加入主节点[preflight] Running pre-flight checks卡住(已解决)k8s常用问题解决

这篇具有很好参考价值的文章主要介绍了k8s从节点加入主节点[preflight] Running pre-flight checks卡住(已解决)k8s常用问题解决。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

一、写在前面

部署k8s时,主节点部署成功了,从节点1执行kubeadm join也成功了,从节点2执行kubeadm join一直卡在[preflight] Running pre-flight checks不动!

二、问题排查

网上查的资料,不管是时间同步,还是重新生成token都尝试了,结果还是不行。
kubeadm token list 查看token也并没有 过期。
kubeadm token create --ttl 0 --print-join-command 重新生成token也不行。
而且重新部署之后,还是不行。

# 0、删除node
kubectl get nodes
kubectl cordon w1 # 不可调度
kubectl drain w1 --ignore-daemonsets
kubectl delete node w1
# 1、重置
kubeadm reset
rm -rf /etc/kubernetes/*
rm -rf ~/.kube
# 2、重新init
# 3、重新执行init后的日志
# 4、重新部署calico网络插件
# 5、从节点重新加入

关键问题是,从节点1正常能加入集群,为什么从节点2无法加入集群???

1、执行join时加上-v=2参数查看日志

[root@w1 ~]# kubeadm join -v=2 192.168.56.100:6443 --token wvsok4.5kjxe1ts8kidll1b --discovery-token-ca-cert-hash sha256:e94113cc2b2fb1b9994c7e419c5f3b776493c7151377812672fe55163b3f97a5
I0703 09:09:38.169190    2029 join.go:367] [preflight] found NodeName empty; using OS hostname as NodeName
I0703 09:09:38.169794    2029 initconfiguration.go:105] detected and using CRI socket: /var/run/dockershim.sock
[preflight] Running pre-flight checks
I0703 09:09:38.169865    2029 preflight.go:90] [preflight] Running general checks
I0703 09:09:38.170055    2029 checks.go:254] validating the existence and emptiness of directory /etc/kubernetes/manifests
I0703 09:09:38.170069    2029 checks.go:292] validating the existence of file /etc/kubernetes/kubelet.conf
I0703 09:09:38.170078    2029 checks.go:292] validating the existence of file /etc/kubernetes/bootstrap-kubelet.conf
I0703 09:09:38.170085    2029 checks.go:105] validating the container runtime
I0703 09:09:38.221649    2029 checks.go:131] validating if the service is enabled and active
I0703 09:09:38.262731    2029 checks.go:341] validating the contents of file /proc/sys/net/bridge/bridge-nf-call-iptables
I0703 09:09:38.262898    2029 checks.go:341] validating the contents of file /proc/sys/net/ipv4/ip_forward
I0703 09:09:38.262920    2029 checks.go:653] validating whether swap is enabled or not
I0703 09:09:38.262941    2029 checks.go:382] validating the presence of executable ip
I0703 09:09:38.263176    2029 checks.go:382] validating the presence of executable iptables
I0703 09:09:38.263554    2029 checks.go:382] validating the presence of executable mount
I0703 09:09:38.263659    2029 checks.go:382] validating the presence of executable nsenter
I0703 09:09:38.263669    2029 checks.go:382] validating the presence of executable ebtables
I0703 09:09:38.263680    2029 checks.go:382] validating the presence of executable ethtool
I0703 09:09:38.263688    2029 checks.go:382] validating the presence of executable socat
I0703 09:09:38.263696    2029 checks.go:382] validating the presence of executable tc
I0703 09:09:38.263703    2029 checks.go:382] validating the presence of executable touch
I0703 09:09:38.263718    2029 checks.go:524] running all checks
I0703 09:09:38.275230    2029 checks.go:412] checking whether the given node name is reachable using net.LookupHost
I0703 09:09:38.275514    2029 checks.go:622] validating kubelet version
I0703 09:09:38.311281    2029 checks.go:131] validating if the service is enabled and active
I0703 09:09:38.316858    2029 checks.go:209] validating availability of port 10250
I0703 09:09:38.317624    2029 checks.go:292] validating the existence of file /etc/kubernetes/pki/ca.crt
I0703 09:09:38.317634    2029 checks.go:439] validating if the connectivity type is via proxy or direct
I0703 09:09:38.317653    2029 join.go:427] [preflight] Discovering cluster-info
I0703 09:09:38.317704    2029 token.go:200] [discovery] Trying to connect to API Server "192.168.56.100:6443"
I0703 09:09:38.318179    2029 token.go:75] [discovery] Created cluster-info discovery client, requesting info from "https://192.168.56.100:6443"
I0703 09:09:38.319099    2029 token.go:83] [discovery] Failed to request cluster info, will try again: [Get https://192.168.56.100:6443/api/v1/namespaces/kube-public/configmaps/cluster-info: dial tcp 192.168.56.100:6443: connect: protocol not available]

发现提示protocol not available,然后我们使用curl https://192.168.56.100:6443/api/v1/namespaces/kube-public/configmaps/cluster-info,发现也确实是提示protocol not available。

从主节点curl,发现有以下提示:

curl: (60) Peer's Certificate issuer is not recognized.
More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). If the default
 bundle file isn't adequate, you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.

但是!我们使用浏览器访问这个网址,发现是https链接的证书出现了问题!

2、处理证书问题

搜了一大堆资料,大致参考了以下:
https://www.cnblogs.com/hkgov/p/14959992.html
https://blog.csdn.net/u012375924/article/details/108832392

(1)处理方式1
将这一串追加到/etc/pki/tls/certs/ca-bundle.crt文件
k8s从节点加入主节点[preflight] Running pre-flight checks卡住(已解决)k8s常用问题解决,云原生,kubernetes,容器,云原生
(2)处理方式2
随便下载一个有效的证书,将该文件上传到目录/etc/pki/ca-trust/source/anchors/下,将文件的后缀名改为.crt, 然后执行命令update-ca-trust extract

再次使用join命令,发现还是不行。

3、重启

再次将主节点重启之后,发现,join命令竟然可以使用了。。。。

# 查看日志
journalctl -u kubelet -f
# 重启k8(如果一直没ready的话)
systemctl restart kubelet && systemctl enable kubelet

4、其他方法1

https://blog.csdn.net/axin_123456/article/details/128961219

可能的原因: 之前错误操作,

systemctl stop NetworkManager--临时关闭

systemctl disable NetworkManager --永久关闭网络管理命令

又重新做了如下操作:

systemctl start NetworkManager

systemctl start network.service --开启网络服务

5、其他方法2

#安装utpdate工具
yum -y install utp ntpdate

timedatectl set-timezone Asia/Shanghai # 设置系统时区为上海

#设置系统时间与网络时间同步
ntpdate cn.pool.ntp.org

#将系统时间写入硬件时间
hwclock --systohc

三、总结

就上面那几种方式……不知道哪一个生效了,最后都是重启主节点之后就好了。注意!只重启主节点即可,重启主节点+从节点仍然不好用。

不知道什么毛病……

要不是为了学习,才不会自己手贱装这玩意。。。

参考资料

https://www.cnblogs.com/hkgov/p/14959992.html
https://blog.csdn.net/u012375924/article/details/108832392文章来源地址https://www.toymoban.com/news/detail-698119.html

到了这里,关于k8s从节点加入主节点[preflight] Running pre-flight checks卡住(已解决)k8s常用问题解决的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • k8s集群加入一个新的node节点

    实验目的:在已有的k8s集群中加入一个新的node节点,并正常工作。 已有的k8s集群节点信息:centos7.9 kubeadm 安装kubernetes集群 192.168.206.130 master 192.168.206.131 k8s-node1 192.168.206.136 k8s-node2 新加入一个节点: 192.168.206.138 k8s-node3 kubectl get nodes  kubectl get nodes -o wide  在进行下面的步骤之

    2024年02月16日
    浏览(36)
  • k8s集群master节点的删除和重新加入

    一、剔除master1节点 1)删除master1节点 3台master下掉一个,剩下2个master运行基本也没问题。坚持个一两天问题不大。 2)清理etcd数据 a.进入etcd容器 b.查看member list c.剔除已删除的master1 二、master1重新加入 1)重置下master1 2)配置一个对域名apiserver.cluster.local的解析 修改 /etc/hosts

    2024年01月22日
    浏览(42)
  • k8s入坑之报错(3)解决error execution phase preflight: [preflight] Some fatal errors occurred...

    参考链接:K8S部署遇到的问题处理汇总node节点加入k8s集群失败kubeadm join 运行出错:FileAvailable--etc-kubernetes-pki-ca.crt,FileAvailable--etc-kubernetes-bootstrap-k 报错查询 error execution phase preflight: [preflight] Some fatal errors occurred [ERROR FileAvailable--etc-kubernetes-kubelet.conf]: /etc/kubernetes/kubelet.conf alr

    2024年02月11日
    浏览(40)
  • [K8S]error execution phase preflight: couldn‘t validate the identity of the API Server

    用kubeadm工具,k8s使用kubeadm join将工作节点加入到主控节点的时候遇到如下问题,执行命令卡顿很久后报错 [root@k8s2 ~]# kubeadm join 192.168.0.180:6443 --token uyylx2.7z02nonw8xgprh5y --discovery-token-ca-cert-hash sha256:0c81e2684c99b6af608f6cdc77c0a81a2d5284d72bcf3353d25fa37bd46839e2 --ignore-preflight-errors=SystemVerifi

    2024年02月05日
    浏览(86)
  • k8s容器加入host解析字段

    一、通过edit或path来修改 kubectl edit deploy /xxxxx. x-n cattle-system xxxxx为你的资源对象名称 二、添加字段  三、code

    2024年02月12日
    浏览(29)
  • k8s集群加入一个master2--kubeadm方式

    已经有一个集群: 192.168.206.138 master 192.168.206.136 k8s-node1 192.168.206.137 k8s-node2 kubectl get nodes -o wide 新加入一个master2节点 192.168.206.139 master2   如果不加这句,加入集群时一定会报错: [preflight] Running pre-flight checks         [WARNING SystemVerification]: missing optional cgroups: pids [preflight]

    2024年01月22日
    浏览(37)
  • 【K8S】docker和K8S(kubernetes)理解?docker是什么?K8S架构、Master节点 Node节点 K8S架构图

    一、docker的问世         在LXC(Linux container)Linux容器虚拟技术出现之前,业界网红是虚拟机。虚拟机技术的代表,是VMWare和OpenStack。 虚拟机是什么?         虚拟机其实就是 在你的操作系统里面,装一个软件,然后通过这个软件,再模拟一台甚至多台“子电脑”出来。

    2024年03月26日
    浏览(48)
  • k8s node 误删除了如何自动创建 csr重新加入集群

    worker node 节点当部署晚 kubelet、kube-proxy就会加入集群,如何加入呢, 集群收到新的 csr 参考: https://kubernetes.io/zh-cn/docs/reference/access-authn-authz/certificate-signing-requests/ https://blog.csdn.net/Michaelwubo/article/details/113769391

    2024年02月13日
    浏览(32)
  • k8s节点删除

    1.设置该节点为不可调度状态 kubectl cordon k8s-node01 2.驱逐该节点上的pod kubectl drain k8s-node01 --ignore-daemonsets --delete-local-data 若是有pod删除不掉则加上--force参数强制驱逐 3.从集群中删除该node节点 kubectl delete node k8s-node01 4.在k8s-node01节点上执行以下命令删除所有数据( 以上命令都是在

    2024年02月07日
    浏览(30)
  • k8s删除node节点

    如果不做上面的操作的话会导致这个节点上的pod无法启动,具体报错信息为:networkPlugin cni failed to set up pod \\\"alertmanager-main-1_monitoring\\\" network: failed to set bridge ad has an IP address different from 10.244.5.1/24 ,意思是已经集群网络cni已经有一个不同于10.244.51.1/24 的网络地址,所以需要执行

    2024年02月08日
    浏览(29)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包