1👍
You could add a simple GET /health
endpoint that returns a 200 status.
Or if you want something more dynamic to what the Kafka consumer is doing, catch exceptions in your consumer and flip a boolean variable that is inspected as part of your /health
route to return 500
code upon any severe error. Kubernetes then will terminate any pods with non-200 HTTP status probe
0👍
First of all, ask yourself two questions:
- Q1: If Kafka does not work, how many APIs or features of your application can continue to work? In another word, how important is Kafka to your application?
- Q2: If Kafka does not work, can it be solved by a restart of the container?
If the answer of Q1 is "some" or "many", then you don’t need to do anything in your readiness probe. Unless the answer of Q1 is "very few" or "none", then you should report 500 in your readiness probe.
If the answer of Q2 is "yes", then you can report 500 in your liveness probe, otherwise just report 200 OK.
The reason behind them can be found here: https://danielw.cn/health-check-probes-in-k8s
- [Answered ]-How can I serialize a Many to Many field with added data in Django Rest Framework, without extra keys in the response?
- [Answered ]-Unreachable code after return statement Angular Material Failing when linked in index.html
- [Answered ]-Want to edit mezzanine footer
- [Answered ]-Django query WHERE 1 IN (column1, column2)