Kafka Client Cannot Connect
Run checks from the affected client’s host, container, or network namespace. A successful test from an administrator laptop does not prove the application path works.
Identify the Failing Layer
Section titled “Identify the Failing Layer”| Layer | Typical signal |
|---|---|
| DNS | Unknown host, bootstrap resolution timeout |
| TCP | Connection refused or timed out |
| TLS | Handshake, trust, hostname, or certificate error |
| SASL | Authentication failure or unsupported mechanism |
| Kafka metadata | Bootstrap succeeds, then other broker connections fail |
| Authorization | Kafka returns a resource-specific denial |
Diagnose
Section titled “Diagnose”getent ahosts kafka.example.comnc -vz -w 5 kafka.example.com 9093
openssl s_client \ -connect kafka.example.com:9093 \ -servername kafka.example.com \ -CAfile ca.pem \ -verify_return_error </dev/null
kafka-cluster.sh list-endpoints \ --bootstrap-server kafka.example.com:9093 \ --command-config client.propertiesCheck every endpoint returned by Kafka, not only the bootstrap address. Common causes include internal DNS names advertised externally, wrong listener ports, a listener mapped to the wrong security protocol, firewall rules that cover only the bootstrap broker, and IPv4/IPv6 differences.
For intermittent failures, correlate disconnect rate with broker restarts, load balancer/NAT idle timeouts, TLS re-authentication, DNS changes, connection quotas, and request-handler saturation.
Kafka 4.4 DNS Behavior
Section titled “Kafka 4.4 DNS Behavior”A positive bootstrap.resolve.timeout.ms allows Java clients to retry bootstrap DNS resolution asynchronously. BootstrapResolutionException means that deadline expired. It does not affect broker hostnames returned in metadata, and Kafka Streams and Connect force synchronous bootstrap resolution.
Recover
Section titled “Recover”- Fix DNS, routes, firewall rules, listener mappings, or advertised endpoints at the owning layer.
- Correct truststores, certificates, SASL mechanisms, or credentials without weakening hostname verification.
- Roll listener changes one broker at a time and preserve a working administration path.
- Restart clients only after the server-side endpoint is correct so they refresh metadata cleanly.
Verify
Section titled “Verify”Test metadata and the real application operation using the affected identity from the affected network. Confirm connections reach all required brokers and remain stable beyond any intermediary idle timeout.
See authentication and authorization failures for deeper security checks.