Kafka + Kubernetes + Helm + `/usr/bin/kafka-avro-console-consumer`?

10/25/2018

How do I use the standard kafka-avro-console-consumer tool with Kafka running via the Confluent Helm Charts? The confluentinc/cp-kafka:5.0.0 image recommended for running cli utilities doesn't contain kafka-avro-console-consumer.

If I shell into the schema-registry pod to use kafka-avro-console-consumer

kubectl exec -it my-confluent-oss-cp-schema-registry-6c8546c86d-pjpmd -- /bin/bash

/usr/bin/kafka-avro-console-consumer --bootstrap-server my-confluent-oss-cp-kafka:9092 --topic my-test-avro-records --from-beginning

Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 5555; nested exception is: 
    java.net.BindException: Address already in use (Bind failed)
sun.management.AgentConfigurationError: java.rmi.server.ExportException: Port already in use: 5555; nested exception is: 
    java.net.BindException: Address already in use (Bind failed)
    at sun.management.jmxremote.ConnectorBootstrap.startRemoteConnectorServer(ConnectorBootstrap.java:480)
    at sun.management.Agent.startAgent(Agent.java:262)
    at sun.management.Agent.startAgent(Agent.java:452)
Caused by: java.rmi.server.ExportException: Port already in use: 5555; nested exception is: 
    java.net.BindException: Address already in use (Bind failed)
-- clay
apache-kafka
confluent-schema-registry
kubernetes
kubernetes-helm

1 Answer

10/26/2018

java.rmi.server.ExportException: Port already in use: 5555;

Sounds like you've enabled JMX as part of that container via the KAFKA_JMX_PORT variable.

If that's the case, you will need to temporarily override that by exporting (or unset) it within the shell session to a different value before running any other Kafka scripts

-- OneCricketeer
Source: StackOverflow