How to get the history of all states while 'describing' a pod in Kubernetes?


One of my pods keeps restarting sometimes. When I do kubectl describe pod <podName> I only get the Last state and not the ones before.

So to find the root of the problem it would be helpful to see all the other states before.

-- SDD

1 Answer


If you use kubectl get pods --output=yaml you will get detailed information about pods in yaml format, you will be able to see 3 last states.

You can also check the last events which was already mentioned by you, using kubectl describe pod <podName>.

Also as stated in Kubernetes documentation Determine the Reason for Pod Failure, you can use Customise the termination message and move /dev/termination-log to a /tmp/ which should be mounted as a separate storage using for example Persistent Volumes

If you are looking into more detailed information regarding storing logs, you would need to check Logging Using Elasticsearch and Kibana or Logging Using Stackdriver.

-- Crou
Source: StackOverflow