Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

View log files of crashed pods in kubernetes

Tags:

kubernetes

Any idea to view the log files of a crashed pod in kubernetes? My pod is listing it's state as "CrashLoopBackOff" after started the replicationController. I search the available docs and couldn't find any.

like image 862
Sudheera Avatar asked Dec 04 '15 09:12

Sudheera


2 Answers

Assuming that your pod still exists:

kubectl logs <podname> --previous

$ kubectl logs -h
-p, --previous[=false]: If true, print the logs for the previous instance of the container in a pod if it exists.

like image 200
Prashanth B Avatar answered Sep 25 '22 06:09

Prashanth B


There was a bug in kubernetes that prevents logs obtaining for pods in CrashLoopBackOff state. Looks like it was fixed. Here issue on github with additional information

like image 29
Vyacheslav Enis Avatar answered Sep 24 '22 06:09

Vyacheslav Enis