Command to check the pod last restart time

Hi All,

command to check the pod last restart time. What is the actual meaning of POD restart ?
A pod restarted but I log in to pod and ran uptime , it up 773 days

Kindly help me on this topic

A pod doesn’t restart, but its containers can. You can derive the information by looking at the status.containerStatutus field in the pod’s json or YAML. I can see the the last started time like this, for a redis pod that’s restarted a few times:

k get po redis-pod -o jsonpath='{.status.containerStatuses[].state.running.startedAt}'
1 Like

Thanks Rob, if someone is asking what is the pod or container uptime . How can I explain them. What is mean of age in k get pod out put.

Most of the people understand that age is the pod uptime

I’m not sure how you measure “pod uptime”, unless you mean that you mean the time since the pod “started”, as defined from .status.startTime:

  startTime	<string>
    RFC 3339 date and time at which the object was acknowledged by the Kubelet.
    This is before the Kubelet pulled the container image(s) for the pod.

I’m pulling my definitions from directly from the docs, as listed by kubectl explain. Not sure where “most of the people” are pulling their’s :slight_smile:

1 Like

Thank you. I got it .