How to list Kubernetes recently deleted pods?

后端 未结 8 872
隐瞒了意图╮
隐瞒了意图╮ 2020-12-14 14:35

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

I am investigating bug. I have logs with my pod name. Th

8条回答
  •  一整个雨季
    2020-12-14 15:41

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

    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.

提交回复
热议问题