我的编程空间,编程开发者的网络收藏夹
学习永远不晚

【水文】calico-node 启动失败 Init:CrashLoopBackOff

短信预约 -IT技能 免费直播动态提醒
省份

北京

  • 北京
  • 上海
  • 天津
  • 重庆
  • 河北
  • 山东
  • 辽宁
  • 黑龙江
  • 吉林
  • 甘肃
  • 青海
  • 河南
  • 江苏
  • 湖北
  • 湖南
  • 江西
  • 浙江
  • 广东
  • 云南
  • 福建
  • 海南
  • 山西
  • 四川
  • 陕西
  • 贵州
  • 安徽
  • 广西
  • 内蒙
  • 西藏
  • 新疆
  • 宁夏
  • 兵团
手机号立即预约

请填写图片验证码后获取短信验证码

看不清楚,换张图片

免费获取短信验证码

【水文】calico-node 启动失败 Init:CrashLoopBackOff

查看日志报错如下 

Defaulted container "calico-node" out of: calico-node, upgrade-ipam (init), install-cni (init), mount-bpffs (init)
Error from server (BadRequest): container "calico-node" in pod "calico-node-4j7td" is waiting to start: PodInitializing

结果:kube-proxy没启动,每个人的环境不同,需要具体排查看日志。下面是分析过程。

一直没看懂上面第一条啥意思,之前搞calico遇到过各种问题,潜意识觉得calico难搞就无脑搜啊搜,以为是疑难杂症,后来网上看到几个相同第一条报错的,才知道没啥价值,浪费了好多时间。

具体错误如下:

[root@k8s-master01 ~]# kubectl logs -n kube-system calico-node-4j7tdDefaulted container "calico-node" out of: calico-node, upgrade-ipam (init), install-cni (init), mount-bpffs (init)Error from server (BadRequest): container "calico-node" in pod "calico-node-4j7td" is waiting to start: PodInitializing[root@k8s-master01 ~]# kubectl get po -A -owideNAMESPACE     NAME           READY   STATUS                  RESTARTS         AGE   IP                NODE           NOMINATED NODE   READINESS GATESkube-system   calico-kube-controllers-6747f75cdc-pzhhj   1/1     Running                 0                52m   172.27.14.194     k8s-node02                kube-system   calico-node-4j7td                          0/1     Init:CrashLoopBackOff   16 (3m58s ago)   43m   192.168.145.161   k8s-master01              kube-system   calico-node-hwttj                          1/1     Running                 0                52m   192.168.145.162   k8s-master02              

【精要】在这个启动失败的节点上,查看容器的日志,如果看不到运行中的容器,就查看exited的容器,如下:

[root@k8s-master01 ~]# crictl psCONTAINER           IMAGE               CREATED             STATE               NAME                ATTEMPT             POD ID              POD[root@k8s-master01 ~]# crictl ps -aCONTAINER           IMAGE               CREATED             STATE               NAME                ATTEMPT             POD ID              POD6e2c272bcbd41       8479c67f450d3       4 minutes ago       Exited              install-cni         17                  0b0d02f6ac576       calico-node-4j7td5c5f54bbda5db       8479c67f450d3       50 minutes ago      Exited              upgrade-ipam        1                   0b0d02f6ac576       calico-node-4j7td[root@k8s-master01 ~]# crictl logs 6e2c272bcbd41time="2022-12-01T15:36:27Z" level=info msg="Running as a Kubernetes pod" source="install.go:145"2022-12-01 15:36:28.196 [INFO][1] cni-installer/ : File is already up to date, skipping file="/host/opt/cni/bin/bandwidth"2022-12-01 15:36:28.197 [INFO][1] cni-installer/ : Installed /host/opt/cni/bin/bandwidth2022-12-01 15:36:28.297 [INFO][1] cni-installer/ : File is already up to date, skipping file="/host/opt/cni/bin/calico"2022-12-01 15:36:28.297 [INFO][1] cni-installer/ : Installed /host/opt/cni/bin/calico2022-12-01 15:36:28.373 [INFO][1] cni-installer/ : File is already up to date, skipping file="/host/opt/cni/bin/calico-ipam"2022-12-01 15:36:28.373 [INFO][1] cni-installer/ : Installed /host/opt/cni/bin/calico-ipam2022-12-01 15:36:28.376 [INFO][1] cni-installer/ : File is already up to date, skipping file="/host/opt/cni/bin/flannel"2022-12-01 15:36:28.376 [INFO][1] cni-installer/ : Installed /host/opt/cni/bin/flannel2022-12-01 15:36:28.381 [INFO][1] cni-installer/ : File is already up to date, skipping file="/host/opt/cni/bin/host-local"2022-12-01 15:36:28.381 [INFO][1] cni-installer/ : Installed /host/opt/cni/bin/host-local2022-12-01 15:36:28.447 [INFO][1] cni-installer/ : File is already up to date, skipping file="/host/opt/cni/bin/install"2022-12-01 15:36:28.447 [INFO][1] cni-installer/ : Installed /host/opt/cni/bin/install2022-12-01 15:36:28.451 [INFO][1] cni-installer/ : File is already up to date, skipping file="/host/opt/cni/bin/loopback"2022-12-01 15:36:28.451 [INFO][1] cni-installer/ : Installed /host/opt/cni/bin/loopback2022-12-01 15:36:28.455 [INFO][1] cni-installer/ : File is already up to date, skipping file="/host/opt/cni/bin/portmap"2022-12-01 15:36:28.455 [INFO][1] cni-installer/ : Installed /host/opt/cni/bin/portmap2022-12-01 15:36:28.459 [INFO][1] cni-installer/ : File is already up to date, skipping file="/host/opt/cni/bin/tuning"2022-12-01 15:36:28.459 [INFO][1] cni-installer/ : Installed /host/opt/cni/bin/tuning2022-12-01 15:36:28.459 [INFO][1] cni-installer/ : Wrote Calico CNI binaries to /host/opt/cni/bin2022-12-01 15:36:28.494 [INFO][1] cni-installer/ : CNI plugin version: v3.25.0-0.dev-519-g2fee4ee0153d2022-12-01 15:36:28.494 [INFO][1] cni-installer/ : /host/secondary-bin-dir is not writeable, skippingW1201 15:36:28.494754       1 client_config.go:617] Neither --kubeconfig nor --master was specified.  Using the inClusterConfig.  This might not work.2022-12-01 15:36:49.499 [ERROR][1] cni-installer/ : Unable to create token for CNI kubeconfig error=Post "https://10.96.0.1:443/api/v1/namespaces/kube-system/serviceaccounts/calico-node/token": dial tcp 10.96.0.1:443: connect: connection refused2022-12-01 15:36:49.499 [FATAL][1] cni-installer/ : Unable to create token for CNI kubeconfig error=Post "https://10.96.0.1:443/api/v1/namespaces/kube-system/serviceaccounts/calico-node/token": dial tcp 10.96.0.1:443: connect: connection refused[root@k8s-master01 ~]#[root@k8s-master01 ~]#[root@k8s-master01 ~]#[root@k8s-master01 ~]#[root@k8s-master01 ~]# kubectl get svcNAME         TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGEkubernetes   ClusterIP   10.96.0.1            443/TCP   2d16h[root@k8s-master01 ~]# kubectl get svc  -ANAMESPACE     NAME           TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGEdefault       kubernetes     ClusterIP   10.96.0.1               443/TCP    2d16hkube-system   calico-typha   ClusterIP   10.107.84.250           5473/TCP   64m[root@k8s-master01 ~]#[root@k8s-master01 ~]#[root@k8s-master01 ~]# telnet 10.96.0.1 443Trying 10.96.0.1...^C[root@k8s-master01 ~]# ping 10.96.0.1PING 10.96.0.1 (10.96.0.1) 56(84) bytes of data.^C--- 10.96.0.1 ping statistics ---1 packets transmitted, 0 received, 100% packet loss, time 0ms

上面发现10.96.0.1不通,去其他节点查看是通的

[root@k8s-node02 ~]#[root@k8s-node02 ~]# telnet 10.96.0.1 443Trying 10.96.0.1...Connected to 10.96.0.1.Escape character is '^]'.^CConnection closed by foreign host.[root@k8s-node02 ~]# ping 10.96.0.1PING 10.96.0.1 (10.96.0.1) 56(84) bytes of data.64 bytes from 10.96.0.1: icmp_seq=1 ttl=64 time=0.061 ms64 bytes from 10.96.0.1: icmp_seq=2 ttl=64 time=0.073 ms^C--- 10.96.0.1 ping statistics ---2 packets transmitted, 2 received, 0% packet loss, time 1057msrtt min/avg/max/mdev = 0.061/0.067/0.073/0.006 ms[root@k8s-node02 ~]# ping 10.96.0.1PING 10.96.0.1 (10.96.0.1) 56(84) bytes of data.64 bytes from 10.96.0.1: icmp_seq=1 ttl=64 time=0.056 ms64 bytes from 10.96.0.1: icmp_seq=2 ttl=64 time=0.067 ms^C--- 10.96.0.1 ping statistics ---2 packets transmitted, 2 received, 0% packet loss, time 1003msrtt min/avg/max/mdev = 0.056/0.061/0.067/0.009 ms

查看问题节点的代理服务kube-proxy,果然,这个居然是disable,郁闷,启动后,delete掉失败的pod,瞬间好了

[root@k8s-master01 ~]# systemctl status kube-proxy● kube-proxy.service - Kubernetes Kube Proxy   Loaded: loaded (/usr/lib/systemd/system/kube-proxy.service; disabled; vendor preset: disabled)   Active: inactive (dead)     Docs: https://github.com/kubernetes/kubernetes[root@k8s-master01 ~]# systemctl enable --now kube-proxyCreated symlink from /etc/systemd/system/multi-user.target.wants/kube-proxy.service to /usr/lib/systemd/system/kube-proxy.service.[root@k8s-master01 ~]# systemctl status kube-proxy● kube-proxy.service - Kubernetes Kube Proxy   Loaded: loaded (/usr/lib/systemd/system/kube-proxy.service; enabled; vendor preset: disabled)   Active: active (running) since Thu 2022-12-01 23:43:25 CST; 2s ago     Docs: https://github.com/kubernetes/kubernetes Main PID: 20930 (kube-proxy)    Tasks: 7   Memory: 52.7M   CGroup: /system.slice/kube-proxy.service           └─20930 /usr/local/bin/kube-proxy --config=/etc/kubernetes/kube-proxy.yaml --v=2[root@k8s-master01 ~]# kubectl get po -A -owide -wNAMESPACE     NAME           READY   STATUS                  RESTARTS         AGE   IP                NODE           NOMINATED NODE   READINESS GATESkube-system   calico-kube-controllers-6747f75cdc-pzhhj   1/1     Running                 0                68m   172.27.14.194     k8s-node02                kube-system   calico-node-4j7td                          0/1     Init:CrashLoopBackOff   19 (3m27s ago)   58m   192.168.145.161   k8s-master01              kube-system   calico-node-hwttj                          1/1     Running                 0                68m   192.168.145.162   k8s-master02              kube-system   calico-node-rjbz8                          1/1     Running                 0                68m   192.168.145.163   k8s-master03              kube-system   calico-node-rmjqj                          1/1     Running                 1 (55m ago)      68m   192.168.145.165   k8s-node02                kube-system   calico-node-vd7w2                          1/1     Running                 0                68m   192.168.145.164   k8s-node01                kube-system   calico-typha-6cdc4b4fbc-sb85z              1/1     Running                 0                68m   192.168.145.164   k8s-node01                ^C[root@k8s-master01 ~]# kubectl delete po -n kube-system calico-node-4j7tdpod "calico-node-4j7td" deleted[root@k8s-master01 ~]# kubectl get po -A -owide -wNAMESPACE     NAME           READY   STATUS     RESTARTS      AGE   IP                NODE           NOMINATED NODE   READINESS GATESkube-system   calico-kube-controllers-6747f75cdc-pzhhj   1/1     Running    0             68m   172.27.14.194     k8s-node02                kube-system   calico-node-hwttj                          1/1     Running    0             68m   192.168.145.162   k8s-master02              kube-system   calico-node-jbvlc                          0/1     Init:1/3   0             2s    192.168.145.161   k8s-master01              kube-system   calico-node-rjbz8                          1/1     Running    0             68m   192.168.145.163   k8s-master03              kube-system   calico-node-rmjqj                          1/1     Running    1 (55m ago)   68m   192.168.145.165   k8s-node02                kube-system   calico-node-vd7w2                          1/1     Running    0             68m   192.168.145.164   k8s-node01                kube-system   calico-typha-6cdc4b4fbc-sb85z              1/1     Running    0             68m   192.168.145.164   k8s-node01                kube-system   calico-node-jbvlc                          0/1     Init:1/3   0             2s    192.168.145.161   k8s-master01              kube-system   calico-node-jbvlc                          0/1     Init:2/3   0             3s    192.168.145.161   k8s-master01              kube-system   calico-node-jbvlc                          0/1     PodInitializing   0             4s    192.168.145.161   k8s-master01              kube-system   calico-node-jbvlc                          0/1     Running           0             5s    192.168.145.161   k8s-master01              ^C[root@k8s-master01 ~]#

世上无难事,只怕有心人还不够,要有脑子,不要浪费不该浪费的时间。

来源地址:https://blog.csdn.net/womenrendeme/article/details/128140831

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

【水文】calico-node 启动失败 Init:CrashLoopBackOff

下载Word文档到电脑,方便收藏和打印~

下载Word文档

猜你喜欢

pm2启动node服务失败怎么办

pm2启动node服务失败的解决办法:1、查看PM2管理器的日志管理node是否成功启动;2、删除node_modules并清除缓冲,然后重新安装;3、找出占用端口的进程并结束它;4、在上传的node项目中更改端口即可。
2023-05-14

pm2启动node服务失败如何解决

这篇文章主要介绍“pm2启动node服务失败如何解决”的相关知识,小编通过实际案例向大家展示操作过程,操作方法简单快捷,实用性强,希望这篇“pm2启动node服务失败如何解决”文章能帮助大家解决问题。pm2启动node服务失败的解决办法:1
2023-07-04

ORACLE OMS启动失败之BEA-300040 I/O error while writing node manager status

今天处理一个oracle优化管理工具oms启动异常的问题。oms问题处理之前,oms所在服务器上的一套asm和db所用的审计目录文件系统inode耗尽导致asm和db异常宕机,经清理审计目录的日志后asm和db正常启动,但是
2023-06-05

redis配置文件启动失败如何解决

如果 Redis 配置文件启动失败,可以尝试以下方法解决:1. 检查配置文件路径是否正确:确保配置文件的路径是正确的,可以使用绝对路径或相对路径。2. 检查配置文件格式是否正确:确保配置文件的格式正确,包括配置项之间的格式、注释的格式等。3
2023-09-11

docker-compose启动docker文件挂载失败的解决

这篇文章主要介绍了docker-compose启动docker文件挂载失败的解决方案。具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教
2023-03-19

docker compose启动docker文件挂载失败如何解决

这篇“docker compose启动docker文件挂载失败如何解决”文章的知识点大部分人都不太理解,所以小编给大家总结了以下内容,内容详细,步骤清晰,具有一定的借鉴价值,希望大家阅读完这篇文章能有所收获,下面我们一起来看看这篇“dock
2023-07-05

Linux系统中/etc/hosts文件设置不对导致Jboss启动失败怎么解决

这篇文章将为大家详细讲解有关Linux系统中/etc/hosts文件设置不对导致Jboss启动失败怎么解决,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。Caused by: javax.ma
2023-06-28

Win8系统启动WiFi共享精灵失败提示5023错误的多种解决方法图文教程

WiFi共享精灵是一款无线共享软件,Win8电脑安装WiFi共享精灵就不用路由器了,实现网络共享。那么Win8系统启动WiFi共享精灵失败出现5023错误怎么办?下面编程网的小编给大家带来具体解决方法。解决方法一:检查网卡是否支持WiFi共
2022-06-04

编程热搜

目录