I am trying to expose cp-kafka brokers publicly using the ingress-nginx and I happen to see this Stack Overflow question. The answers only shows one broker is exposed outside the cluster. Say, If I have 3 brokers running, how can I expose all 3 Kafka brokers using the nginx ingress controller?
2
Answers
I was able to fix it by changing the tcp-services configMap data to the one below.
31090: "default/demo-cp-kafka-0-nodeport:19092"
Kafka is using binary protocol so you cannot use http routing.
You would need to expose brokers on a separate ports. Read this page in ingress-nginx docs: Exposing TCP and UDP services. The answer you linked already explains how to do this for one port/service. Now all you have to do is expose two more ports. Since you cannot open a port number more than once, you need to expose every broker on a separate port.