zoukankan      html  css  js  c++  java
  • 处理 K8S Orphaned pod found

    问题概述

    查看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 
    $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

  • 相关阅读:
    归档拷贝LogMiner 和 archived redo log,分析归档日志
    宋体测试液晶屏测试小程序
    宋体方法Unity3d通过苹果和google两种方法加入广告
    代码确认小米官方在线预定——对代码实现的分析
    分区启动Grub2配置详解
    临时表判断sqlite 判断表 或 临时表 是否存在
    解释升级JDeveloper&ADF的版本
    引用字符shell中的引用java教程
    枚举生成MVC3: Bind Enum To DropDownList ?java教程
    能力学习为什么你应聘不上或试用期被开?
  • 原文地址:https://www.cnblogs.com/Aaron-23/p/13164215.html
Copyright © 2011-2022 走看看