Apache Kafka consumer groups and microservices running on Kubernetes, are they compatible?

7/21/2017

So far, I have been using Spring Boot apps (with Spring Cloud Stream) and Kafka running without any supporting infrastructure (PaaS).

Since our corporate platform is running on Kubernetes we need to move those Spring Boot apps into K8s to allow the apps to scale and so on. Obviously there will be more than one instance of every application so we will define a consumer group per application to ensure the unique delivery and processing of every message.

Kafka will be running outside Kubernetes.

Now my doubt is: since the apps deployed on k8s are accessed through the k8s service that abstracts the underlying pods, and individual application pods can't be access directly outside of the k8s cluster, Kafka won't know how to call individual instances of the consumer group to deliver the messages, will it?

How can I make them work together?

-- codependent
apache-kafka
kubernetes
microservices
openshift
spring-cloud-stream

2 Answers

7/21/2017

Kafka brokers do not push data to clients. Rather clients poll() and pull data from the brokers. As long as the consumers can connect to the bootstrap servers and you set the Kafka brokers to advertise an IP and port that the clients can connect to and poll() then it will all work fine.

-- Hans Jespersen
Source: StackOverflow

7/21/2017

Can Spring Cloud Data Flow solve your requirement to control the number of instances deployed?

and, there is a community released Spring Cloud Data Flow server for OpenShift: https://github.com/donovanmuller/spring-cloud-dataflow-server-openshift

-- Ilayaperumal Gopinathan
Source: StackOverflow