Is there a way to get some details about Kubernetes pod that was deleted (stopped, replaced by new version).
I am investigating bug. I have logs with my pod name. Th
kubectl get pods -a
you will get the list of running pods and the terminated pods in case you are searching for this
There is a way to find out why pods were deleted and who deleted them.
The only way to find out something is to set the ttl
for k8s to be greater than the default 1h and search through the events:
kubectl get event -o custom-columns=NAME:.metadata.name | cut -d "." -f1
as far as i know you may not get the pod details once the pod is deleted. can i know what is the usecase?
example:
You can try kubectl logs --previous
to list the logs of a previously stopped pod
http://kubernetes.io/docs/user-guide/kubectl/kubectl_logs/
You may also want to check out these debugging tips http://kubernetes.io/docs/user-guide/debugging-pods-and-replication-controllers/
There is this flag:
-a, --show-all=false: When printing, show all resources (default hide terminated pods.)
But this may not help in all cases of old pods.
If your container has previously crashed, you can access the previous container’s crash log with:
kubectl logs --previous ${POD_NAME} ${CONTAINER_NAME}