How to get the time taken for Pod to boot up using Promethus

23 Views Asked by At

I need to get the time taken by a pod to boot up from Pod Scheduled to Pod running status using Prometheus metrics.

I understand these information are avaiable in kubectl pod commands, but need to get as part of promql query.

1

There are 1 best solutions below

0
Jorge Luis On

You can take a look at the pod metrics from kube-state-metrics. There is a ton of valuable information there.

For this specific case, I think that kube_pod_container_state_started and kube_pod_status_scheduled_time could be of interest to you:

From the kube-state-metrics docs:

  • kube_pod_status_scheduled_time: Unix timestamp when pod moved into scheduled status
  • kube_pod_container_state_started: Start time in unix timestamp for a pod container.

The difference between these metrics should provide the amount of time that a pod was scheduled but not yet running.