Reputation: 369
I have a deployment of pods which failed 22h ago, how often does Kubernetes log-rotate its logs?
Is there any possibility to view the logs of the deployment but 22 hours ago?
Thanks
Upvotes: 0
Views: 2423
Reputation: 9
These logs cannot be retrieved, if you have stored these logs in newrelic or someplace then you can filter with service name and pod name to retrieve the last logs that exist for this pods
Upvotes: 0
Reputation: 8411
Kubernetes does NOT provide built-in log rotation.
Check official Debug Running Pods documentation:
If your container has previously crashed, you can access the previous container's crash log with:
kubectl logs --previous ${POD_NAME} ${CONTAINER_NAME}
kubectl describe pods ${POD_NAME}
4.All I wrote above is great, however sometimes the only way to get the logs is @confused genius answer.
Upvotes: 0
Reputation: 1121
You can use kubectl logs --previous to retrieve logs from a previous instantiation of a container.
Upvotes: 0
Reputation: 3244
I think we can not retrieve logs from a pod that is not in ready state. We can get the logs of the container inside the pod , By logging into the worker node where pod was running .
docker ps -a | grep <pod name>
docker logs <container name/id from above output
Upvotes: 1