Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the default value of initialDelaySeconds?

Kubernetes' liveness and readiness probes for pods (deployment) can be configured with this initial delay ---- meaning the probe will start after this many seconds after the container is up. If it is not specified, what is the default value? I can't seem to find it. The default value for periodSeconds is documented as 10 second.

Thanks

like image 201
RyanDing Avatar asked Feb 01 '18 22:02

RyanDing


People also ask

What is the purpose of the livenessProbe?

livenessProbe: Indicates whether the Container is running. If the liveness probe fails, the kubelet kills the Container, and the Container is subjected to its restart policy. If a Container does not provide a liveness probe, the default state is Success.

What is Readinessprobe?

A readiness probe indicates whether applications running in a container are ready to receive traffic. If so, Services in Kubernetes can send traffic to the pod, and if not, the endpoint controller removes the pod from all services.

What happens if startup probe fails?

If a container fails its startup probe, then the container is killed and follows the pod's restartPolicy . This type of probe is only executed at startup, unlike readiness probes, which are run periodically. The startup probe is configured in the spec. containers.

How do you fix readiness probe failure?

Increase the Timeout of the Readiness Probe To increase the Readiness probe timeout, configure the Managed controller item and update the value of "Readiness Timeout". By default it set to 5 (5 seconds). You may increase it to for example 30 (30 seconds).


2 Answers

It seems that the default value of 0 is missing from the documentation.

The health or readiness check algorithm works like this:

  1. Wait for initialDelaySeconds
  2. Perform readiness check and wait timeoutSeconds for a timeout
  3. If the number of continued successes is greater than successThreshold return success
    If the number of continued failures is greater than failureThreshold return failure
    otherwise wait periodSeconds and start a new readiness check
like image 76
Lukas Eichler Avatar answered Oct 02 '22 16:10

Lukas Eichler


Given the pace at which the project changes, I wanted to make sure the code actually confirms this.

Found a test in the public Kubernetes repo that verifies the default settings for probes:

    expectedProbe := v1.Probe{
        InitialDelaySeconds: 0,
        TimeoutSeconds:      1,
        PeriodSeconds:       10,
        SuccessThreshold:    1,
        FailureThreshold:    3,
    }

See method TestSetDefaultProbe in

https://github.com/kubernetes/kubernetes/blob/master/pkg/apis/core/v1/defaults_test.go

like image 38
Enrico M. Avatar answered Oct 02 '22 16:10

Enrico M.