How to get logs from a pod/container which is in state, init:0/1?

553 views
Skip to first unread message

sri...@biarca.com

unread,
Sep 22, 2017, 5:21:00 PM9/22/17
to Kubernetes developer/contributor discussion
Hi All,

I tried kubectl logs <POD-NAME>. It returned an error, pod not found. If i try same command with other pods which are in state, running, the command is working. How do I debug this pod/container which is stuck in state, init:0/1 with retry count >0.

Thanks,
Srini

Warren Strange

unread,
Sep 22, 2017, 6:24:29 PM9/22/17
to Kubernetes developer/contributor discussion

If there is an init-pod you can get the output by providing -c :

kubectl logs pod-name -c init-container-name 

Warren Strange

unread,
Sep 22, 2017, 6:25:31 PM9/22/17
to Kubernetes developer/contributor discussion

should read "init container", not "init pod" 

Clayton Coleman

unread,
Sep 22, 2017, 6:30:59 PM9/22/17
to Warren Strange, Kubernetes developer/contributor discussion
This is really a bug, kubectl logs should show the logs of the currently running init container if the pod is still initializing without needing -c.
--
You received this message because you are subscribed to the Google Groups "Kubernetes developer/contributor discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-de...@googlegroups.com.
To post to this group, send email to kuberne...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kubernetes-dev/b4882113-8fe4-47ce-bf7b-056321f58954%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages