How can I access the pod when it become CrashLoopBackOff?

4/26/2018

Right now, I deployed some pods on my kubernetes cluster. But sometime, my image may has some bugs which make the pod cannot start correctly.

For example: nats-1 0/1 CrashLoopBackOff 121 10h

I also cannot see any error in the kubectl log.

So is there any way to access this pod? Or is there any tools or tech can allow to to enter the container?

Thanks a lot all! :)

-- JordanZT
kubernetes
kubernetes-pod

2 Answers

4/26/2018

Edited after clarification:

You could go into the worker (kubectl get pod <pod-name> -o wide to get which one) and access the node syslogs or pods' logs. That should show you a more detailed information of what happened.

But @ho-man approach is very valid and less cumbersome.

-- sevillo
Source: StackOverflow

4/26/2018

You can kubectl describe to get the events, it sometimes might show some errors there. Otherwise you can probably also make the deployment/pod run a command like sleep 3600 to keep it open for you to exec into it to investigate further.

-- Ho Man
Source: StackOverflow