I would like to find the number of seconds between when the pod was assigned to when the service becomes ready. When i look at the event log for a pod, there is no event that signals when the service becomes ready. Is this something that I need to write a custom script for, or is there somewhere else I can look?
While there is no exact mechanism for that purpose built in Kubernetes provides pod conditions:
PodScheduled
: the Pod has been scheduled to a node.ContainersReady
: all containers in the Pod are ready.Initialized
: all init containers have started successfully.Ready
: the Pod is able to serve requests and should be added to the load balancing pools of all matching Services.With already created Pod you can fetch this data using:
And observe those conditions:
You can also use
jq
for yaml parsing.Another solution that comes to my mind is Kube-state-metrics:
With it you can export object creation time (
kube_pod_start_time
) and object ready status (kube_pod_status_ready
). There are of course more metrics available for the pod and other kubernetes objects here.Please remember that if you are about to measure your
pod start time
you have assume that all images needed to run that pod are already pre-pulled on the machine. Otherwise your measurement will not be correct as it will include variables that influence Kubernetes performance such as network or image size.