Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it a good way to run Kafka on Kubernetes?

For a large online application, use k8s to run it. The scale maybe daily activity user 500,000.

The application inside k8s need messaging feature - Pub/Sub, there are these options:

  • Kafka
  • RabbitMQ
  • Redis

Kafka

It needs zookeeper and good to run on os depends on disk I/O. So if install it into k8s cluster, how? The performance will be worse?

And, if keep Kafka outside of the k8s cluster, connect Kafka from application inside the k8s cluster, how about that performance? They are in the different layer, won't be slow?

RabbitMQ

It's slow than Kafka, but for a daily activity user 500,000 application, is it good enough? If so, maybe it's a good choice.

Redis

It's another option. Maybe the most simple one. But from the internet I got that it will lose message sometimes. If true, that's terrible.


So, the most important thing is, use Kafka(also with zookeeper) on k8s, good or not in this use case?

like image 614
online Avatar asked Dec 23 '17 02:12

online


3 Answers

For Kafka, you can find some suggestion here. Kubernetes 1.7+ supports local persistent volume, which may be good for Kafka deployment.

like image 36
ccshih Avatar answered Oct 21 '22 20:10

ccshih


Yes, running Kafka on Kubernetes is great. Check out this example: https://github.com/Yolean/kubernetes-kafka. It includes ZooKeeper and Kafka as StatefulSets.


PS. Running any of the services in your question on Kubernetes will be pleasant. You can Google the name of the service and "kubernetes" and find example manifests. Many examples here: https://github.com/kubernetes/charts.

like image 136
Dmitry Minkovsky Avatar answered Oct 21 '22 20:10

Dmitry Minkovsky


You can also take a look to the following project :

https://github.com/EnMasseProject/barnabas

It's about running Kafka on Kubernetes and OpenShift as well. It provides deploying with StatefulSets with persistent volumes or just in memory (for developing or just testing purpose). It provides deploying for Kafka Connect and Prometheus metrics as well.

like image 1
ppatierno Avatar answered Oct 21 '22 20:10

ppatierno