如何列出Kubernetes最近删除的Pod? [英] How to list Kubernetes recently deleted pods?

查看:111
本文介绍了如何列出Kubernetes最近删除的Pod?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有办法获取有关已删除(已停止,已被新版本替换)的Kubernetes pod的一些详细信息.

Is there a way to get some details about Kubernetes pod that was deleted (stopped, replaced by new version).

我正在调查错误.我有我的pod名称的日志.该吊舱已不存在,已被另一个(具有不同配置)的吊舱所代替.新的Pod与旧的Pod驻留在相同的名称空间,复制控制器和服务中.

I am investigating bug. I have logs with my pod name. That pod does not exist anymore, it was replaced by another one (with different configuration). New pod resides in same namespace, replication controller and service as old one.

类似命令

kubectl  get pods
kubectl  get pod <pod-name> 

仅适用于当前的广告连播(活动或停止).

work only with current pods (live or stopped).

如何获得有关旧豆荚的更多详细信息?我想看

How I could get more details about old pods? I would like to see

  1. 创建它们时
  2. 创建时拥有的环境变量
  3. 为什么以及何时停止

推荐答案

从今天开始,不推荐使用kubectl get pods -a,结果您将无法删除已删除的pod.

As of today, kubectl get pods -a is deprecated, and as a result you cannot get deleted pods.

但是,您可以做的是获取最近删除的pod名称的列表-过去最多1个小时,除非您通过运行以下命令更改kubernetes事件的ttl:

What you can do though, is to get a list of recently deleted pod names - up to 1 hour in the past unless you changed the ttl for kubernetes events - by running:

kubectl get event -o custom-columns=NAME:.metadata.name | cut -d "." -f1

然后,如果有的话,您可以调查日志记录管道中的其他问题.

You can then investigate further issues within your logging pipeline if you have one in place.

这篇关于如何列出Kubernetes最近删除的Pod?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆