0

I know I can view logs of a crash pod by using kubectl logs --previous

But if a pod belongs to a deployment, when it crashes, a new pod with a different name is going to be created.

I can no longer know the crashed pod name.

Where can I find the log of the crashed pod?

And how can I know if/when/why the pod crashed?

2 Answers 2

1

If a Deployment-managed Pod crashes, the same Pod will restart, and you can look at its logs using kubectl logs --previous the same as before.

If you manually kubectl delete pod something a Deployment manages, you'll lose its logs and the Deployment will create a new one; but you have to explicitly do that, if a pod fails it will be the same pod restarting (or in CrashLoopBackOff state).

Sign up to request clarification or add additional context in comments.

Comments

0

If you can't get the logs then try the below command to know the reason why the pod is failed to start

kubectl describe pod  <pod-name>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.