How to get pod start time in millisecond in kubernetes

3/1/2019

I am trying to get the performance of the pod scheduling.

When kubectl describe pod performancetestpod. We will get something similar as shown below

Type    Reason     Age   From                       Message
  ----    ------     ----  ----                       -------
  Normal  Scheduled  21s   default-scheduler          Successfully assigned default/performancetestpod to ip-172-31-22-111
  Normal  Pulled     20s   kubelet, ip-172-31-22-111  Container image "centos:7.6.1810" already present on machine
  Normal  Created    20s   kubelet, ip-172-31-22-111  Created container
  Normal  Started    20s   kubelet, ip-172-31-22-111  Started container
  Normal  Killing    10s   kubelet, ip-172-31-22-111  Killing container with id docker://performancetestpod:Need to kill Pod

1, Is there any way to get the age in milliseconds.

2, Is there any other way to get values in milliseconds for pod start, for eg: by using prometheus etc

-- JibinNajeeb
docker
kubernetes

1 Answer

3/1/2019

From my experience there is no way to get milliseconds using kubectl in the way you do it. Answering your 2nd question - take a closer look at kube-state-metrics. As per A Deep Dive into Kubernetes Metrics article:

Object Creation Time

Often is it helpful to know at what time objects in Kubernetes where created. Kube-state-metrics exposes a creation time for almost all the objects it tracks. The metric name follows the pattern kube_<OBJECT>_created and will include values for the name of the object and the namespace where it lives. The value is an epoch timestamp to the millisecond.

For example, the CronJob creation series is called kube_cronjob_created.

-- VKR
Source: StackOverflow