处理 K8S Orphaned pod found - but volume paths are still present on disk 孤儿pod
问题概述#
查看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
分类:
Kubernetes
, Troubleshooting
标签:
Kubernetes
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律