A container restarted after a crash and current logs only show the new instance. How can the developer read logs from the previous terminated container?
Select an answer to reveal the explanation.
Short Explanation
After a restart, ‘current’ logs are the new process—the crash story is in the previous instance. kubectl logs --previous grabs that last terminated container’s output. Don’t delete the Pod hoping Events will replay the full stack trace.
Full Explanation
The --previous flag instructs kubectl logs to retrieve logs from the prior terminated container instance after a restart. That is essential for CrashLoopBackOff diagnosis when the current stream only reflects the new process. Deleting the Pod, emptying tails, or ignoring prior crashes discards or skips the needed evidence.