Kubernetes readiness(http) probe is failing but liveness (http) is working fine without readiness

1/25/2020

Kubernetes readiness (http) probe is failing, however liveness (http) is working fine without readiness. Using the following, tested with different initialDelaySeconds.

readinessProbe:
  httpGet:
    path: /healthz
    port: 8080
  initialDelaySeconds: 120
  periodSeconds: 10
livenessProbe: 
  httpGet: 
    path: /healthz 
    port: 8080
  initialDelaySeconds: 120 
  periodSeconds: 10
-- Pthota
google-kubernetes-engine
kubernetes

2 Answers

2/4/2020

It's working fine after increasing the initialDelaySeconds to 150 seconds. As the Container is taking longer than 120 seconds to come up sometimes and few times it is under 120 seconds.

-- Pthota
Source: StackOverflow

1/27/2020

The readiness and liveness probes serve slightly different purposes:

  • the readiness probe controls whether the pod IP is included in the list of endpoints for a service, and so also whether a target for a route when it is exposed via an external URL;

  • the liveness probe determines whether a pod is still running normally or whether it should be restarted.

Theoretically situation like you describe could happened if something wrong with exposing of your service for example. Have a look at the best practices here, also you can find some extra information here.

-- Serhii Rohoza
Source: StackOverflow