I am creating an architecture for my microservices plateform running over Kubernetes.
My current architecture looks like:
Description:
And I was wondering, what if my RabbitMQ crashed :
So my question is the following:
Is it a good practice to seperate the consumer process into a independant container ?
-> The container will run along side the main app in the same pod.
-> The sidecar consumer will have a liveness endpoint, so if RabbitMQ Crashed again, Kubernetes will start only this container.
-> The sidecar consumer will have access to database to write events.
-> The producer can stay in the main app (flask), more resilient for me.
Yes, I think that's a good approach, because you rely on Kubernetes to check if that container is up or not (with the liveness probe), instead of doing that from the application.
You can also monitor/alert events like that (containers which are down) using the observability stack of the cluster.