Readiness and liveness probes for application with dependencies (DB, Celery, RabbitMQ)
Imagine there is a Django application. The application dependencies: DB, Celery (workers, beat), RabbitMQ (as a broker for Celery). If with liveness probe it is more or less clear (if the liveness probe did not pass, it restarts pod), then with readiness probe there is no full understanding. They write that readiness probes determine whether the container is ready to accept traffic. In this regard, the following questions arise:
- For the application configuration described above (with dependencies), what would a readiness probe look like? Will it be an endpoint that checks the availability to the database, RabbitMQ, the health of the Celery workers?
- If the readiness test is complex (checking the availability of the database, RabbitMQ, Celery workers), then what will Kubernetes do if, for example, RabbitMQ becomes unavailable? Because all containers work with the same RabbitMQ, it makes no sense to switch traffic to another pod.