Anyway to reload the deleted pods from kubernetics cluster

2/11/2020

I want to reload the deleted pods from the Kubernetes cluster . Is that possible?.

Is there a way to get some details about the Kubernetes pod that was deleted (stopped, replaced by new version).

-- Riby Varghese
kubectl
kubernetes
kubernetes-pod
pod
rancher

2 Answers

2/12/2020

If you have a deployment object, you may fetch the last deployed versions or may rollback to previous versions based on the revision history value set in the deployment object.

As explained by @Bartosz Bilicki here How to list Kubernetes recently deleted pods? you can also fetch the data from the events.

I hope it helps.

-- Vaibhav Jain
Source: StackOverflow

2/11/2020

There is the option -p if with you want to check the logs from terminated pods.

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

kubectl logs -p terminated-pod-name

The pod itself is ephemeral as well as its information unless you keep them with a persistent volume you are not able to recover such information once the pod is terminated/deleted. If you need to debug the pod you can use the describe.

kubectl describe pod pod-name
-- Daniel Marques
Source: StackOverflow