Reputation: 31
I need to use the ip of kafka for my other microservices. but when am deploying by this method theres no external IP moreover when am trying with localhost everything is working fine. so can anyone help me in understanding how to set up the ext IP of lb for the Kafka here to use it in
Upvotes: 0
Views: 1550
Reputation: 3684
Kafka can be installed as LoadBalancer External Service Type on kubernetes using helm. Steps are here. Following is needed in helm's values.yaml
to do it:
external:
enabled: true
type: LoadBalancer
...
"advertised.listeners": |-
EXTERNAL://${LOAD_BALANCER_IP}:31090
"listener.security.protocol.map": |-
PLAINTEXT:PLAINTEXT,EXTERNAL:PLAINTEXT
Kafka installed as LoadBalancer External Service Type:
$ kubectl -n kafka get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kafka ClusterIP 10.39.241.217 <none> 9092/TCP 2m39s
kafka-0-external LoadBalancer 10.39.242.45 35.200.238.174 31090:30108/TCP 2m39s
kafka-1-external LoadBalancer 10.39.241.90 35.244.44.162 31090:30582/TCP 2m39s
kafka-2-external LoadBalancer 10.39.243.160 35.200.149.80 31090:30539/TCP
Now, to connect external clients to kafka, deploy kubernetes ingress in front of this kafka service using following links:
Upvotes: 0
Reputation: 39910
You just need to configure advertised listeners so that external clients can connect.
To do so, you need to configure advertised.listeners
inside server.properties
:
advertised.listeners=PLAINTEXT://your-kafka-host-1:9092,PLAINTEXT://your-kafka-host-1:9093,PLAINTEXT://your-kafka-host-2:9092,...
Alternatively, if you are using Docker images, you simply need to export KAFKA_ADVERTISED_LISTENERS
.
Upvotes: 2