简体   繁体   中英

How to connect to kafka installed using confluent helm chart

I have a kubernetes cluster hosted on azure cloud. I had installed kafka resources using below helm chart https://github.com/confluentinc/cp-helm-charts/tree/master/charts/cp-kafka . This helm chart successfully deployed zoopkeeper pods and broker pods etc. Now I want to write a golang based application which connects with any of the kafka broker installed on my kubernetes cluster and creates a new producer and publishes messages. Any help would be highly appreciated.

You can use the following string in bootstrap.servers to communicate with the brokers <helm-release-name>-cp-kafka-headless.<namespace>:9092 or bootstrap service which is created as part of confluent helm chart <helm-release-name>-cp-kafka . When you hit this service, it will randomly got to any of the brokers for the first time and get all the metadata information which is synced through zookeeper.

The subsequent requests will be made to individual brokers based on information found in metadata.

您将在容器中部署 Golang 代码,在 k8s 中,然后将bootstrap.servers设置为 Kafka 部署的服务名称,理想情况下通过环境变量

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM