1

HTTP Kubernetes liveness and readiness checks are configured as per the documentation.

The initialDelaySeconds field tells the kubelet how long it should wait before performing the first liveness / readiness probe.

In this official blog article by a Google Developer Advocate it says:

I recommend using the p99 startup time as the initialDelaySeconds, or just take the average startup time and add a buffer. As your app's startup time gets faster or slower, make sure you update this number.

... possibly implying that monitoring of your app's startup time is a reasonably trivial or built-in kubernetes function!?

  • Is there a metric available in Kubernetes for container or pod startup time (time between either "pending" or "running" to the time the liveness check succeeds)?

  • If there is no existing metric, is there any kubectl command, other API or plugin, that can be used to determine the equivalent information?


Clarify:

My environment uses Scala / Finagle, which seems to need a significant amount of time to start and warm-up (60-300 seconds depending on resource limits), so accuracy to within a few seconds is fine. There is no need for the solution to be second/millisecond accurate.


Small progress update:

I found that the kubectl command below can be used to show the time between the completion of the initialization phase, and the pod being ready to serve requests. However, the Ready time here would already include initialDelaySeconds, rather than indicating the earliest time the pod was actually able to serve. Also, this gives overall times for the pod, but no information about specific containers.

kubectl get pod $POD_NAME -o 'go-template=
{{range .status.conditions}}
  {{if and (or (eq .type "Initialized") (eq .type "Ready")) (eq .status "True")}}
    {{printf "%s ==> %s\n" .type .lastTransitionTime }}
  {{end}}
{{end}}'

output:

Initialized ==> 2019-05-28T01:47:35Z
Ready ==> 2019-05-28T01:50:24Z

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.