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

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

如何通过 Confluent Helm Charts 将标准 kafka-avro-console-consumer 工具与 Kafka 运行 一起使用?为 运行 cli 实用程序推荐的 confluentinc/cp-kafka:5.0.0 映像不包含 kafka-avro-console-consumer

如果我 shell 进入 schema-registry pod 使用 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)

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

听起来您已经通过 KAFKA_JMX_PORT 变量启用了 JMX 作为该容器的一部分。

如果是这种情况,您需要在 运行 任何其他 Kafka 脚本之前,通过在 shell 会话中将其导出(或 unset)为不同的值来临时覆盖它