1

I am quite confused about readiness probe. Suppose I use httpGet with /health as the probing endpoint. Once the readiness check returns 500, the server will stop serving traffic. Then how can the /health endpoint work? In other words, once a readiness check fails, how can it ever work again since it can no longer answer to future /health checks?

I guess one valid explanation is that the path is invoked locally? (i.e. not through the https:${ip and port}/health)

Brian Shih
  • 301
  • 1
  • 8
  • 1
    you should use /health endpoint in livenessProbe so kubernetes will kill and start another pod. for readiness you can use another endpoint related to your business logic. – m303945 Jul 10 '20 at 19:24
  • This should answer your question: https://stackoverflow.com/a/46029885/10020419 – Chris Jul 10 '20 at 19:50

1 Answers1

3

You have typo.. you said :

Once the readiness check returns 500, the server will stop serving traffic.

However, it should be :

Once the readiness check returns 500, the k8s service will stop serving traffic.

enter image description here

k8s service behaves like a load balancer for multi-pods.

  • If pod is ready, an endpoint will be created for the ready pod, and the traffic will be received.
  • If pod is not ready, its endpoint will be removed and it will not more receive traffic.

While Readiness Probe decides to forward traffic or not, Liveness Probe decides to restart the Pod or not.

If you want to get rid off unhealthy Pod, you have to specify also Liveness Probe.

So let's summarize:

To get full HA deployment you need 3 things together:

  • Pod are managed by Deployment which will maintain a number of replicas.
  • Liveness Probe will help to remove/restart the unlheathy pod.. After somtime ( 6 restarts), the Pod will be unhealthy and the Deployment will take care to bring new one.
  • Readiness Probe will help forward traffic to only ready pods : Either at beginning of run, or at the end of run ( graceful shutdown).
Abdennour TOUMI
  • 87,526
  • 38
  • 249
  • 254