问题概述

查看kubelet或/var/log/messages日志一直包错,发现是孤儿pod,是由于其pod被删除后存储路径还保存在磁盘。

报错如下

[root@node5 ~]# journalctl -fu kubelet
-- Logs begin at Tue 2020-06-16 23:41:14 CST. --
Jun 19 17:25:12 node5 kubelet[4711]: E0619 17:25:12.038458 4711 kubelet_volumes.go:154] orphaned pod "27960f19-29f1-486a-9a9d-c6c9290d014a" found, but volume paths are still present on disk : There were a total of 2 errors similar to this. Turn up verbosity to see them.
Jun 19 17:25:14 node5 kubelet[4711]: E0619 17:25:14.071432 4711 kubelet_volumes.go:154] orphaned pod "27960f19-29f1-486a-9a9d-c6c9290d014a" found, but volume paths are still present on disk : There were a total of 2 errors similar to this. Turn up verbosity to see them.
Jun 19 17:25:16 node5 kubelet[4711]: E0619 17:25:16.037737 4711 kubelet_volumes.go:154] orphaned pod "27960f19-29f1-486a-9a9d-c6c9290d014a" found, but volume paths are still present on disk : There were a total of 2 errors similar to this. Turn up verbosity to see them.
Jun 19 17:25:18 node5 kubelet[4711]: E0619 17:25:18.070147 4711 kubelet_volumes.go:154] orphaned pod "62e47eeb-8de7-4d4e-9e0f-28503d63be6a" found, but volume paths are still present on disk : There were a total of 1 errors similar to this. Turn up verbosity to see them.
Jun 19 17:25:20 node5 kubelet[4711]: E0619 17:25:20.036447 4711 kubelet_volumes.go:154] orphaned pod "62e47eeb-8de7-4d4e-9e0f-28503d63be6a" found, but volume paths are still present on disk : There were a total of 1 errors similar to this. Turn up verbosity to see them.
Jun 19 17:25:22 node5 kubelet[4711]: E0619 17:25:22.069562 4711 kubelet_volumes.go:154] orphaned pod "62e47eeb-8de7-4d4e-9e0f-28503d63be6a" found, but volume paths are still present on disk : There were a total of 1 errors similar to this. Turn up verbosity to see them.
Jun 19 17:25:24 node5 kubelet[4711]: E0619 17:25:24.065490 4711 kubelet_volumes.go:154] orphaned pod "62e47eeb-8de7-4d4e-9e0f-28503d63be6a" found, but volume paths are still present on disk : There were a total of 1 errors similar to this. Turn up verbosity to see them.
Jun 19 17:25:26 node5 kubelet[4711]: E0619 17:25:26.073979 4711 kubelet_volumes.go:154] orphaned pod "62e47eeb-8de7-4d4e-9e0f-28503d63be6a" found, but volume paths are still present on disk : There were a total of 1 errors similar to this. Turn up verbosity to see them.
Jun 19 17:25:28 node5 kubelet[4711]: E0619 17:25:28.037987 4711 kubelet_volumes.go:154] orphaned pod "62e47eeb-8de7-4d4e-9e0f-28503d63be6a" found, but volume paths are still present on disk : There were a total of 1 errors similar to this. Turn up verbosity to see them.
Jun 19 17:25:30 node5 kubelet[4711]: E0619 17:25:30.068136 4711 kubelet_volumes.go:154] orphaned pod "62e47eeb-8de7-4d4e-9e0f-28503d63be6a" found, but volume paths are still present on disk : There were a total of 1 errors similar to this. Turn up verbosity to see them.

解决办法

解决思路

  • 根据/var/log/messages或kubelet报错,查找孤儿pod
  • 通过mount命令查找孤儿pod的挂载
  • 卸载孤儿pod的存储挂载
  • 删除/var/lib/kubelet/pods下孤儿pod的存储路径

使用脚本处理,脚本内容如下

#!/bin/sh

orphanedPods=`cat /var/log/messages|grep 'orphaned pod'|awk -F '"' '{print $2}'|uniq`;
orphanedPodsNum=`echo $orphanedPods|awk -F ' ' '{print NF}'`;
echo -e "orphanedPods: $orphanedPodsNum \n$orphanedPods"; for i in $orphanedPods
do
echo "Deleting Orphaned pod id: $i";
rm -rf /var/lib/kubelet/pods/$i;
done

在报错的节点直接执行脚本即可

相关issue:

https://github.com/kubernetes/kubernetes/issues/60987

https://github.com/kubernetes/kubernetes/pull/68616

最新文章

  1. asp.net mvc 事件顺序
  2. angularjs with node service
  3. jQuery ajax - serialize() 方法-输出序列化表单值
  4. (旧)子数涵数·UI设计——扁平化设计
  5. 前端之JavaScript第四天学习(10)-JavaScript-运算符
  6. RabbitMQ 原文译05--Topics
  7. java基础(一章)
  8. Web Service--第一次接触web service
  9. 数组去重方法(ES6)
  10. 【MySQL】计算 TPS,QPS 的方式
  11. visual studio 2010 Error: IntelliSense: identifier "DWORD" is undefined
  12. 【数据结构】【平衡树】无旋转treap
  13. bs4模块
  14. Android string资源 包含 数学符号等特殊字符 及 参数占位符
  15. mybatis源码分析(一)------------入门
  16. 用Java进行大数处理(BigInteger)-hdu1042
  17. laravel中消息通知功能
  18. ceph-mon 代码解读
  19. SharePoint 关于拓扑错误的解决方案
  20. Django的AutoField字段

热门文章

  1. SpringCloud 的版本问题 (深入)
  2. 用Python从头开始构建神经网络
  3. C#WebApi 接口增加备注和测试 默认api文档
  4. mysqld程序结构介绍
  5. 201326JJ
  6. 用python写注入漏洞的poc
  7. 认识ollydbg
  8. 使用@Cacheable注解时,Redis连不上,直接调用方法内部的解决方案
  9. NIO 的工作方式
  10. docker 使用笔记