Closed dinopuguh closed 8 months ago
+1 using TLS, and inside a k8s cluster
Thank you for taking the time to raise this issue. However, it has not had any activity on it in the past 90 days and will be closed in 30 days if no updates occur. Please check if the master branch has already resolved the issue since it was raised. If you believe the issue is still valid and you would like input from the maintainers then please comment to ask for it to be reviewed.
+1 using docker-compose in a similar way as documented in the ticket. Interestingly enough, same error reproduces implementing the kafka consumer code with confluent-kafka-go, but running with segment.io client the consumer code is able to connect to the broker.
Also, with services running from a similar docker compose set up, we are able to do docker exec my-ap ping kafka
and the IP is resolved correctly
+1 I am facing a similar issue . The app is working fine on local network as well as when deployed on server but when deployed on k8s it starts giving the issue "cluster not reachable" . Using TLS
Anyone has succeeded with that? I'm spending the last 2 days on this issue 🤦♂️
More information:
docker run --network mynetwork -it taion809/kafka-cli:2.2.0 /bin/bash
[sarama] 2021/10/13 15:09:25 client.go:138: Initializing new client
[sarama] 2021/10/13 15:09:25 config.go:544: ClientID is the default of 'sarama', you should consider setting it to something application-specific.
[sarama] 2021/10/13 15:09:25 config.go:544: ClientID is the default of 'sarama', you should consider setting it to something application-specific.
[sarama] 2021/10/13 15:09:25 client.go:871: client/metadata fetching metadata for all topics from broker localhost:9092
[sarama] 2021/10/13 15:09:25 broker.go:160: Failed to connect to broker localhost:9092: dial tcp [::1]:9092: connect: connection refused
[sarama] 2021/10/13 15:09:25 client.go:914: client/metadata got error from broker -1 while fetching metadata: dial tcp [::1]:9092: connect: connection refused
[sarama] 2021/10/13 15:09:25 client.go:925: client/metadata no available broker to send metadata request to
[sarama] 2021/10/13 15:09:25 client.go:661: client/brokers resurrecting 1 dead seed brokers
[sarama] 2021/10/13 15:09:25 client.go:855: client/metadata retrying after 250ms... (3 attempts remaining)
[sarama] 2021/10/13 15:09:25 config.go:544: ClientID is the default of 'sarama', you should consider setting it to something application-specific.
[sarama] 2021/10/13 15:09:25 client.go:871: client/metadata fetching metadata for all topics from broker localhost:9092
[sarama] 2021/10/13 15:09:25 broker.go:160: Failed to connect to broker localhost:9092: dial tcp [::1]:9092: connect: connection refused
[sarama] 2021/10/13 15:09:25 client.go:914: client/metadata got error from broker -1 while fetching metadata: dial tcp [::1]:9092: connect: connection refused
[sarama] 2021/10/13 15:09:25 client.go:925: client/metadata no available broker to send metadata request to
[sarama] 2021/10/13 15:09:25 client.go:661: client/brokers resurrecting 1 dead seed brokers
[sarama] 2021/10/13 15:09:25 client.go:855: client/metadata retrying after 250ms... (2 attempts remaining)
[sarama] 2021/10/13 15:09:25 config.go:544: ClientID is the default of 'sarama', you should consider setting it to something application-specific.
[sarama] 2021/10/13 15:09:25 client.go:871: client/metadata fetching metadata for all topics from broker localhost:9092
[sarama] 2021/10/13 15:09:25 broker.go:160: Failed to connect to broker localhost:9092: dial tcp [::1]:9092: connect: connection refused
[sarama] 2021/10/13 15:09:25 client.go:914: client/metadata got error from broker -1 while fetching metadata: dial tcp [::1]:9092: connect: connection refused
[sarama] 2021/10/13 15:09:25 client.go:925: client/metadata no available broker to send metadata request to
[sarama] 2021/10/13 15:09:25 client.go:661: client/brokers resurrecting 1 dead seed brokers
[sarama] 2021/10/13 15:09:25 client.go:855: client/metadata retrying after 250ms... (1 attempts remaining)
[sarama] 2021/10/13 15:09:26 config.go:544: ClientID is the default of 'sarama', you should consider setting it to something application-specific.
[sarama] 2021/10/13 15:09:26 client.go:871: client/metadata fetching metadata for all topics from broker localhost:9092
[sarama] 2021/10/13 15:09:26 broker.go:160: Failed to connect to broker localhost:9092: dial tcp [::1]:9092: connect: connection refused
[sarama] 2021/10/13 15:09:26 client.go:914: client/metadata got error from broker -1 while fetching metadata: dial tcp [::1]:9092: connect: connection refused
[sarama] 2021/10/13 15:09:26 client.go:925: client/metadata no available broker to send metadata request to
[sarama] 2021/10/13 15:09:26 client.go:661: client/brokers resurrecting 1 dead seed brokers
[sarama] 2021/10/13 15:09:26 client.go:234: Closing Client
Unable to get cluster admin: kafka: client has run out of available brokers to talk to (Is your cluster reachable?)
I also tried to reset docker to factory mode(macos), and multiple configurations and docker images for Kafka. It seems like this problem only persists with sarama, and not with other clients.
This is really odd - since the code just parse the metadata response
Yes, the confluent go kafka client worked fine for this. In case you are not using any admin commands you are better off with any other library or you might have to switch to a different language lib if you are looking for admin functions. It appears sarama is not able to parse hostname within a cluster and hence not able to connect.
my bad, it works.
Thank you for taking the time to raise this issue. However, it has not had any activity on it in the past 90 days and will be closed in 30 days if no updates occur. Please check if the main branch has already resolved the issue since it was raised. If you believe the issue is still valid and you would like input from the maintainers then please comment to ask for it to be reviewed.
It’s not immediately obvious from the provided logs why you are hitting errors with the Kafka image and docker-compose pair that you mention. Certainly Sarama can connect to docker based setups with a network defined, the FVT runs exactly in this way. I’d recommend the docker-compose.yml and Dockerfile.kafka in the root folder of this repo as your starting point
Thank you for taking the time to raise this issue. However, it has not had any activity on it in the past 90 days and will be closed in 30 days if no updates occur. Please check if the main branch has already resolved the issue since it was raised. If you believe the issue is still valid and you would like input from the maintainers then please comment to ask for it to be reviewed.
Versions
Configuration
This is my application called as
my-app
:docker-compose.yml
file:Logs
When I set
KAFKA_HOST:kafka
indocker-compose.yml
:logs: CLICK ME
``` Error creating consumer group client: kafka: client has run out of available brokers to talk to (Is your cluster reachable?) ```
Problem Description
Sarama can't create a consumer group with that configuration. But, if I set
KAFKA_HOST
with Kafka container's IP Address, it works very well. So, I think sarama cannot accept brokers that defined with the hostname.please for your help, thank you.