OpenShift - Unable to connect Strimzi from KafkaJS

半城伤御伤魂 提交于 2019-12-11 19:36:40

问题


I have Strimzi Kafka cluster set-up successfully on OpenShift. I can see the following services:

  • kafka-brokers
  • kafka-bootstrap
  • zookeeper-client
  • zookeeper-nodes

This is actually different from what is called out here; so, not sure, if this is a Strimzi installation issue. I followed installation steps from here.

I created a routes for kafka-bootstrap and kafka-brokers on port 9092 (non-TLS clients). In both cases, I get a ECONNREFUSED error when I provide the route value (e.g. my-cluster-myproject.192.168.99.100.nip.io:9092 in the example from kafkajs.

How do I get the kafkajs package connected to the Strimzi cluster?


回答1:


The Strimzi services that you are seeing are correct but in order to access the Kafka brokers, it's better using the bootstrap service which allows to specify only one "broker" in the bootstrap servers list of your client and it will select a broker to connect the first time and then getting metadata (it avoids to you to connect using the headless service where the pod IPs can change on restart). So saying that, if you need to access the brokers from outside of OpenShift you don't have to create a route for the bootstrap service manually but you have to configure external listeners (https://strimzi.io/docs/latest/#assembly-configuring-kafka-broker-listeners-deployment-configuration-kafka) with type route. As already mentioned above, the OpenShift routes work with TLS only for TCP connections. In order to provide your clients the right certificate tu use for TLS you can follow this part of the documentation: https://strimzi.io/docs/latest/#kafka_client_connections




回答2:


Have you checked out external listeners?

BTW, if you need to expose strimzi by router, TLS encryption is necessary. OpenShift router does not support TCP, but support TLS.



来源:https://stackoverflow.com/questions/58222337/openshift-unable-to-connect-strimzi-from-kafkajs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!