2

I created a deployment in which the container always fails, I noticed a new container is automatically created because of the restart policy, but then I am unable to check the log of the failed container. Is there a way to check the log?

2

1 Answer 1

4

You can use the kubectl logs --previous flag:

--previous If true, print the logs for the previous instance of the container in a pod if it exists.

Example:

kubectl logs my-pod-crashlooping --container my-container --previous
Sign up to request clarification or add additional context in comments.

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.