-
Notifications
You must be signed in to change notification settings - Fork 138
[BUG] Lookup can not find broker address in k8s #633
Comments
It's a legacy design to implement the basic functions quickly. It's right that the current lookup design can be optimized to reuse broker's logic. We also found other problems introduced by using the builtin Would you like to contribute a PR to fix it? |
Current advertisedListeners has a validation that address must start with Could we consider a total solution with #574? We could regist multi kafka-listeners into advertisedListeners with different listenerName and port, but may be we need to make some change in broker side to remove the validation of |
Which part of code do you mean? Do you mean in Pulsar side, what the Currently the work for #574 hasn't started, it may take some time to look into this issue. |
In Pulsar side there is a Class |
I'm afraid it's not easy to reuse the Regarding to
could you provide some help since I remember you have tried the |
The configurations Maybe we could use these configurations? Using the configuration
The lookup result is |
Client outside k8s can not connect to kop through the lookup result
I have made 1 and 2 in my k8s, for 3 I have workaround way to make it possible currently. |
Describe the bug
Deploy broker with kop in k8s, expose ports with nodeport.
when
advertisedAddress
is not same with the first address inadvertisedListeners
, lookup can not find broker address in k8sTo Reproduce
![kop](https://user-images.githubusercontent.com/65590138/128325574-5e77823f-1b9f-42e8-bcf1-702a3de4f173.PNG)
I use nodeip:nodeport to expose the address of brokers in k8s.
Here is the service stats of broker.
configuration of broker.conf:
advertisedAddress: {worknode_ip}:30873
advertisedListeners: internal:{headless service domain}:6650,external:pulsar://{worknode_ip}:31964
kafkaListeners=PLAINTEXT://0.0.0.0:9092
kafkaAdvertisedListeners=PLAINTEXT://{worknode_ip}:31553
Pulsar client can connect to pulsar outside k8s with
pulsar://{worknode_ip}:31964
by settinglistenerName
withexternal
But when use kafka client outside k8s connect to pulsar with
{worknode_ip}:31553
, it will fail to get topic metadata due to broker lookup failed.Additional context
Current lookup logic of kop:
pulsarService.getClient().getLookup().getBroker()
to find the broker of topic, result isInetSocketAddress
/loadbalance/brokers/
InetSocketAddress
in step 1InetSocketAddress
kafkaAdvertisedListeners
of that broker in step 4In my condition, in step 1 the lookup result is the first address in
![kop2](https://user-images.githubusercontent.com/65590138/128326346-be2ffe0d-1760-4926-994f-2d679e696a11.PNG)
advertisedListeners
. which is{headless service domain}:6650
, and in step 2 the broker address under/loadbalance/brokers/
is{worknode_ip}:30873
. because the broker address here will be used in admin request redirection, I need to set the address here with nodeport in order to handle admin request outside.Then because
{headless service domain}
is not same with{worknode_ip}
, step 3 will fail with no match broker.Current workaround:
In step 1, I create a pulsar client for topic lookup with listenerName
extenrnal
instead of use the pulsar client ofpulsarService.getClient()
, so the result could be{worknode_ip}:31964
Suggestion:
I'm not sure why kop use such lookup logic. That may have problem when
advertisedAddress
is not same with the first address inadvertisedListeners
, which is default lookup result ofpulsarService.getClient().getLookup().getBroker()
.Can we use the lookup logic of
advertisedListeners
in pulsar to handle the topic lookup in kop?kafka-listener
.advertisedListeners
withkafka-listener
:pulsar-internal:{headless service domain}:6650,pulsar-external:pulsar://{worknode_ip}:31964,kafka-listener:pulsar://{worknode_ip}:31553
kafka-listener
,we could get the expect lookup result{worknode_ip}:31553
in one step.The text was updated successfully, but these errors were encountered: