Repaso
EspaƱol
Cloud & DevOpsAdvancedOPS-12

Readiness probe vs liveness probe?

Options

  1. They are identical, and both restart the container when they fail
  2. Failing readiness removes the pod from traffic; failing liveness restarts it (Correct option)
  3. Liveness controls the traffic; readiness restarts the container
  4. Both checks delete the pod from the cluster when they fail once

Answer

Readiness failing removes the pod from Service traffic; liveness failing restarts the container

Why

Kubernetes regularly calls health endpoints of your app.

  • Readiness: 'can you handle requests right now?' If not (still starting, warming a cache), the Pod gets no traffic, but is not restarted.
  • Liveness: 'are you still working at all?' If not (stuck, deadlocked), the container is restarted.

Don't check the database in the liveness probe: a database outage would restart all your Pods at once.

Remember

Readiness = send traffic? Liveness = restart?

Key terms

Practice this question in Repaso