trynocoding commented on issue #601: URL: https://github.com/apache/pulsar-helm-chart/issues/601#issuecomment-2808841456
> > [@lhotari](https://github.com/lhotari) Thank you, following above method, I can now access it outside the cluster > > [@trynocoding](https://github.com/trynocoding) would you be interested in contributing the changes to pulsar-helm-chart or sharing how you have achieved this? That could help others wishing to configure their Pulsar cluster in a similar way. @lhotari At first, I only exposed the Pulsar protocol externally, which allowed normal access,the configuration is as follows ``` [root@master samples]# for i in `seq 0 2`; do kubectl -n pulsar-operator-system exec -it pulsarcluster-sample-broker-$i -- cat /pulsar/conf/broker.conf |egrep 'advertisedListeners|advertisedAddress|internalListenerName|bindAddresses|brokerServiceURL'|grep -v "#";done Defaulted container "broker" out of: broker, wait-bookkeeper-ready (init) bindAddresses= advertisedAddress=pulsarcluster-sample-broker-0.pulsarcluster-sample-broker.pulsar-operator-system.svc.cluster.local advertisedListeners=internal:pulsar://10.0.0.15:6650,external:pulsar://192.66.111.120:32566 internalListenerName=internal Defaulted container "broker" out of: broker, wait-bookkeeper-ready (init) bindAddresses= advertisedAddress=pulsarcluster-sample-broker-1.pulsarcluster-sample-broker.pulsar-operator-system.svc.cluster.local advertisedListeners=internal:pulsar://10.0.0.98:6650,external:pulsar://192.66.111.120:32386 internalListenerName=internal Defaulted container "broker" out of: broker, wait-bookkeeper-ready (init) bindAddresses= advertisedAddress=pulsarcluster-sample-broker-2.pulsarcluster-sample-broker.pulsar-operator-system.svc.cluster.local advertisedListeners=internal:pulsar://10.0.0.148:6650,external:pulsar://192.66.111.120:31984 internalListenerName=internal [root@master samples]# ``` When both Pulsar and HTTP protocols are exposed externally, accessing the broker via the HTTP protocol from outside the cluster results in an error,the configuration is as follows ``` [root@master samples]# for i in `seq 0 2`; do kubectl -n pulsar-operator-system exec -it pulsarcluster-sample-broker-$i -- cat /pulsar/conf/broker.conf |egrep 'advertisedListeners|advertisedAddress|internalListenerName|bindAddresses|brokerServiceURL'|grep -v "#";done Defaulted container "broker" out of: broker, wait-bookkeeper-ready (init) bindAddresses= advertisedAddress=pulsarcluster-sample-broker-0.pulsarcluster-sample-broker.pulsar-operator-system.svc.cluster.local advertisedListeners=internal:pulsar://10.0.0.15:6650,external:pulsar://192.66.111.120:32566,internal:http://10.0.0.15:8080,external:http://192.66.111.120:31896 internalListenerName=internal Defaulted container "broker" out of: broker, wait-bookkeeper-ready (init) bindAddresses= advertisedAddress=pulsarcluster-sample-broker-1.pulsarcluster-sample-broker.pulsar-operator-system.svc.cluster.local advertisedListeners=internal:pulsar://10.0.0.98:6650,external:pulsar://192.66.111.120:32386,internal:http://10.0.0.98:8080,external:http://192.66.111.120:31598 internalListenerName=internal Defaulted container "broker" out of: broker, wait-bookkeeper-ready (init) bindAddresses= advertisedAddress=pulsarcluster-sample-broker-2.pulsarcluster-sample-broker.pulsar-operator-system.svc.cluster.local advertisedListeners=internal:pulsar://10.0.0.148:6650,external:pulsar://192.66.111.120:31984,internal:http://10.0.0.148:8080,external:http://192.66.111.120:31741 internalListenerName=internal [root@master samples]# [root@master samples]# kubectl -n pulsar-operator-system get svc NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE pulsar-operator-webhook-service ClusterIP 10.96.1.9 <none> 443/TCP 8m pulsarcluster-sample-bookie ClusterIP None <none> 3181/TCP 6m22s pulsarcluster-sample-broker ClusterIP None <none> 8080/TCP,6650/TCP 6m22s pulsarcluster-sample-broker-0-external NodePort 10.96.2.144 <none> 8080:31896/TCP,6650:32566/TCP 6m22s pulsarcluster-sample-broker-1-external NodePort 10.96.3.114 <none> 8080:31598/TCP,6650:32386/TCP 6m22s pulsarcluster-sample-broker-2-external NodePort 10.96.3.19 <none> 8080:31741/TCP,6650:31984/TCP 6m22s pulsarcluster-sample-broker-nodeport NodePort 10.96.0.178 <none> 8080:30370/TCP,6650:30650/TCP 6m22s pulsarcluster-sample-zookeeper ClusterIP None <none> 2888/TCP,3888/TCP,2181/TCP 7m45s ``` Using the http protocol, the client error message is as follows ``` client, err := pulsar.NewClient(pulsar.ClientOptions{ URL: "http://100.100.3.198:30370", ListenerName: "external", }) [root@crazy producer]# go run http_producer.go INFO[0000] Connecting to broker remote_addr="pulsar://10.0.0.148:6650" WARN[0004] Failed to connect to broker. error="dial tcp 10.0.0.148:6650: connect: connection timed out" remote_addr="pulsar://10.0.0.148:6650" ERRO[0004] Failed to get connection topic="persistent://public/default/test-topic" ERRO[0004] Failed to create producer at newPartitionProducer error="connection error" topic="persistent://public/default/test-topic" 2025/04/16 16:10:47 connection error exit status 1 ``` I don't know why, but when accessed via HTTP protocol, it returns the pod's IP and the Pulsar protocol's port Using the pulsar protocol, the client is fine ``` client, err := pulsar.NewClient(pulsar.ClientOptions{ URL: "pulsar://100.100.3.198:30650", ListenerName: "external", }) [root@crazy producer]# go run producer.go INFO[0000] Connecting to broker remote_addr="pulsar://100.100.3.198:30650" INFO[0000] TCP connection established local_addr="192.66.111.72:32768" remote_addr="pulsar://100.100.3.198:30650" INFO[0000] Connection is ready local_addr="192.66.111.72:32768" remote_addr="pulsar://100.100.3.198:30650" INFO[0000] Connecting to broker remote_addr="pulsar://192.66.111.120:31984" INFO[0000] TCP connection established local_addr="192.66.111.72:5568" remote_addr="pulsar://192.66.111.120:31984" INFO[0000] Connection is ready local_addr="192.66.111.72:5568" remote_addr="pulsar://192.66.111.120:31984" INFO[0000] Connected producer cnx="192.66.111.72:5568 -> 192.66.111.120:31984" epoch=0 topic="persistent://public/default/test-topic" INFO[0000] Created producer cnx="192.66.111.72:5568 -> 192.66.111.120:31984" producerID=1 producer_name=pulsarcluster-sample-2-307 topic="persistent://public/default/test-topic" 2025/04/16 16:38:01 Published message: 6:307:0 INFO[0000] Closing producer producerID=1 producer_name=pulsarcluster-sample-2-307 topic="persistent://public/default/test-topic" INFO[0000] Closed producer producerID=1 producer_name=pulsarcluster-sample-2-307 topic="persistent://public/default/test-topic" [root@crazy producer]# ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
