Deleted Pod Logs

9/12/2019

I recently had an event that resulted in my pod being evicted and in order to quickly reestablish service I proceeded to delete the pod which resulted in a new one being spun up.

Is there any way to describe or retrieve logs from a deleted pod so that I can perform RCA on why the pod was evicted in the first place?

-- dfuentes
kubernetes

2 Answers

9/13/2019

From my experience, once you manually delete K8s Pod, the corresponded containers and their relevant logging data will be purged as well, thus --previous flag works only if the previous container instance still exists in Pod.

If true, print the logs for the previous instance of the container in a pod if it exists.

You might consider in future implementing log aggregation software like Fluentd, Logspout or Logstash data collector in ELK stack.

-- mk_sta
Source: StackOverflow

9/13/2019

If it is just previous one you can try --previous flag with your logs command. More details here

-- Bimal
Source: StackOverflow