23 Aralık 2022 Cuma

Probe Çeşitleri - Startup Probe

Giriş
Açıklaması şöyle
The startup probe ensures the pod is initiated and created successfully. 
Açıklaması şöyle. Yani Startup aşamasını geçtikten sonra artık Liveness devreye giriyor
If Startup probe succeeds, it is replaced by the Liveness probe which will then be executed normally as configured. If the Startup probe fails, the pod is restarted and the cycle repeated.
SpringBoot İçin Not
Açıklaması şöyle. Actuator tarafından sağlanan liveness zaten Kubernetes Liveness Probe için kullanılacağı için bence /actuator/health/readiness adresini kullanmak daha iyi. Eğer custom bir şey yazılacaksa HealthIndicator kullanılabilir.
Spring Boot does not expose a separate endpoint for the startup probe. You could use the liveness probe, readiness probe, or a custom-developed health indicator for this use case. The reason to have a different probe in Kubernetes is to enable a long timeout for the initial startup of the application, which might take some time. After the first successful startup probe call, the liveness probe takes over, reducing timeout values to detect a failure and restart the application quickly.
Örnek
Şöyle yaparız
startupProbe:
  httpGet:
    path: /probes/liveness
    initialDelaySeconds: 5
    periodSeconds: 5
    timeoutSeconds: 3
    failureThreshold: 18
livenessProbe:
  httpGet:
    path: /probes/liveness
    periodSeconds: 5
    timeoutSeconds: 3
    failureThreshold: 3
Açıklaması şöyle
This configuration sets a Startup probe to be started 5 seconds after the container creation (initialDelaySeconds), and executed every 5 seconds (periodSeconds) with a tolerance to fail 18 times (failureThreshold). So only after the 18th failure, this probe will cause the container to be restarted.

On the other hand (and here is the trick) as we’re using the default success threshold, as soon as it succeeds this probe is deactivated and the Liveness probe starts to be executed, but the later with a more realistic failure threshold of only 3 times.

So packing everything up, now this container have up to 90 seconds to be available at startup but as soon as it becomes available, any problem can be detected in no more than 15 seconds.
Örnek
Şöyle yaparız
startupProbe:
  httpGet:
    path: /actuator/health/readiness
    port: 8080
  periodSeconds: 5
  failureThreshold: 30
  initialDelaySeconds: 10
  timeoutSeconds: 1


Hiç yorum yok:

Yorum Gönder

Cluster Propotional Autoscaler - ReplicaSet Ekler/Siler

Giriş Açıklaması şöyle CPA aims to horizontally scale the number of Pod replicas based on the cluster’s scale. A common example is DNS ser...