Skip to main content

AW: Kafka 2.8.0 "KRaft" - advertised.listeners port mismatch?

Hello Mike,

this is a bug which I also have already noticed. This has already been fixed (https://github.com/apache/kafka/pull/10935) and it will be released with Kafka 3.0.0 (https://issues.apache.org/jira/browse/KAFKA-13003).
[https://opengraph.githubassets.com/0ca691b1fbe7df32144cb42a8cca70a806b01d3faa4d8a533771acd38bba100f/apache/kafka/pull/10935]<https://github.com/apache/kafka/pull/10935>
KAFKA-13003: In kraft mode also advertise configured advertised port instead of socket port by ueisele · Pull Request #10935 · apache/kafka<https://github.com/apache/kafka/pull/10935>
In Kraft mode Apache Kafka 2.8.0 does advertise the socket port instead of the configured advertised port. A broker given with the following configuration listeners=PUBLIC://0.0.0.0:19092,REPLICATI...
github.com
I created a Docker Image of Kafka 3.0.0 SNAPSHOT with the fix included (https://hub.docker.com/layers/154845427/ueisele/apache-kafka-server/3.0.0-SNAPSHOT/images/sha256-7f5f240062e4c788347cff0f674ae3c546deb89123db3b72715fa31c83445e8b?context=repo). Here is an example: https://github.com/ueisele/kafka/blob/fix/kraft-advertisedlisteners-build/proxy-examples/proxyl4-kafkakraft-fix-trunk/docker-compose.yaml
[https://opengraph.githubassets.com/1c158e3dc860f2f3f4e1eec56799a7e62d6648137c72a1170272bb9d7f0818fe/ueisele/kafka]<https://github.com/ueisele/kafka/blob/fix/kraft-advertisedlisteners-build/proxy-examples/proxyl4-kafkakraft-fix-trunk/docker-compose.yaml>
kafka/docker-compose.yaml at fix/kraft-advertisedlisteners-build · ueisele/kafka<https://github.com/ueisele/kafka/blob/fix/kraft-advertisedlisteners-build/proxy-examples/proxyl4-kafkakraft-fix-trunk/docker-compose.yaml>
Mirror of Apache Kafka. Contribute to ueisele/kafka development by creating an account on GitHub.
github.com
I hope this helps.

Best Regards,
Uwe
________________________________
Von: Mike Pontillo <mpontillo@digitalocean.com.INVALID>
Gesendet: Donnerstag, 12. August 2021 03:53
An: users@kafka.apache.org <users@kafka.apache.org>
Betreff: Kafka 2.8.0 "KRaft" - advertised.listeners port mismatch?

Greetings,

I'm trying to create a container (suitable for testing purposes) that
runs a single-instance (and "zookeeper free") Kafka instance using the
"KRaft" functionality in 2.8.0.

In the configuration file, I have configured the listeners as follows:

listeners=CONTROLLER://127.0.0.1:9093,INTERNAL://127.0.0.1:9094,EXTERNAL://
0.0.0.0:9092
inter.broker.listener.name=INTERNAL
advertised.listeners=INTERNAL://127.0.0.1:9094,EXTERNAL://127.0.0.1:55032
controller.listener.names=CONTROLLER
listener.security.protocol.map=CONTROLLER:PLAINTEXT,INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT

Then I forward a random port to port 9092 inside the container. However,
when I connect to the container from the outside, the client sees an
advertised port of 9092, which is only configured in the "listeners" key:

$ kafkacat -L -b 127.0.0.1:55033
Metadata for all topics (from broker -1: 127.0.0.1:55033/bootstrap):
1 brokers:
broker 1 at 127.0.0.1:9092 (controller)
0 topics:

Can anyone spot anything I'm doing that is obviously incorrect? Is this
a possible bug? (If there is interest, I can also share more details around
how this container is being built.)

Regards,
Mike

Comments