我正在尝试使用我的minikube集群中的kafka控制台生产者和消费者。
这些是我的服务:
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
java-api NodePort 10.108.162.108 <none> 8080:30141/TCP 8d
kafka-service NodePort 10.104.71.239 <none> 29092:32676/TCP 66m
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 12d
zookeeper ClusterIP 10.106.78.82 <none> 2181/TCP 66m
我的部署
NAME READY UP-TO-DATE AVAILABLE AGE
java-api 1/1 1 1 8d
kafka 1/1 1 1 141m
zookeeper 1/1 1 1 141m
我的豆荚
NAME READY STATUS RESTARTS AGE
java-api-55ff8cbf8b-xkrcj 1/1 Running 0 8d
kafka-77486f8d89-jhgtk 1/1 Running 0 143m
zookeeper-64b8b5cf6b-bt67h 1/1 Running 0 143m
我跑了 kubectl exec -it kafka-77486f8d89-jhgtk /bin/bash
当我跑步时: kafka-console-consumer.sh --bootstrap-server 10.104.71.239:29092 --topic Kafka_Example --from-beginning
我明白了:
WARN [Consumer clientId=consumer-console-consumer-60284-1, groupId=console-consumer-60284] Connection to node -1 (/10.104.71.239:29092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
和
当我跑步时: kafka-console-producer.sh --broker-list 10.104.71.239:29092 --topic Kafka_Example
过了一会儿我就知道了:
[2020-09-29 11:46:23,697] ERROR Error when sending message to topic Kafka_Example with key: null, value: 3 bytes with error: (org.apache.kafka.clients.producer.internals.ErrorLoggingCallback)
org.apache.kafka.common.errors.TimeoutException: Topic Kafka_Example not present in metadata after 60000 ms.
主题存在:
I have no name!@kafka-77486f8d89-jhgtk:/bin$ kafka-topics.sh --list --zookeeper zookeeper:2181
Example_Topic
Kafka_Example
1条答案
按热度按时间krugob8w1#
我移除了
类型:节点端口
Kafka服务,现在消费者和生产者在容器内工作。