How to get status history/lineage for Kubernetes pods

4/14/2020

I was wondering if there is a kubectl command to quickly get the history of all STATUS for a given pod?

for example: Lets say a pod - my-test-pod went from ContainerCreating to Running to OomKill to Terminating:

I was wondering if there is a command that experts use to get this lineage. Appreciate a nudge..

-- irrelevantUser
kubectl
kubernetes

2 Answers

4/15/2020

kubectl get events or kubectl describe pod which shows the events for the pod at the bottom. However events are only kept for a little while, so it's not a permanent history. For that you would need some webhooks or a tool like Prometheus.

-- coderanger
Source: StackOverflow

4/15/2020

Using kubectl get events you can only see events of last 1 hour. If you want to persist events for a longer duration you can sue eventrouter.The event router serves as an active watcher of event resource in the kubernetes system, which takes those events and pushes them to a user specified sink. This is useful for a number of different purposes, but most notably long term behavioral analysis of your workloads running on your kubernetes cluster.

-- Arghya Sadhu
Source: StackOverflow