2

I have some fairly simple Golang code (pulled directly from from confluent's Golang port of their kafka C library librdkafka) however my client refuses to connect over SSL from my k8s cluster in gcp.

The error I'm getting is the following (where <server-id> is some kind of alphanumeric value given by confluent cloud):

%3|1654287436.757|FAIL|rdkafka#producer-1| [thrd:sasl_ssl://<server-id>.europe-west2.gcp.confluent.cloud:9092/boot]: sasl_ssl://<server-id>.europe-west2.gcp.confluent.cloud:9092/bootstrap: Failed to resolve '<server-id>.europe-west2.gcp.confluent.cloud:9092': No address associated with hostname (after 0ms in state CONNECT)

My code:

c, err := kafka.NewConsumer(&kafka.ConfigMap{
        "bootstrap.servers":                     fmt.Sprintf("%s:%s", kafkaAddress, kafkaPort),
        "group.id":                              "myGroup",
        "security.protocol":                     "SASL_SSL",
        "sasl.mechanisms":                       "PLAIN",
        "sasl.username":                         kafkaUser,
        "sasl.password":                         kafkaPass,
        "session.timeout.ms":                    "45000",
        "ssl.endpoint.identification.algorithm": "",
        "auto.offset.reset":                     "latest",
    })
    if err != nil {
        log.Println(err)
    }
    c.SubscribeTopics([]string{"myTopic", "^aRegex.*[Tt]opic"}, nil)

    for {
        msg, err := c.ReadMessage(-1)
        if err == nil {
            fmt.Printf("Message on %s: %s\n", msg.TopicPartition, string(msg.Value))
        } else {
            // The client will automatically try to recover from all errors.
            fmt.Printf("Consumer error: %v (%v)\n", err, msg)
        }
    }
  • Seems like DNS failed. Are you able to `ping .europe-west2.gcp.confluent.cloud`? – OneCricketeer Jun 03 '22 at 21:21
  • After trying out a different service, it appears that @OneCricketeer is correct and this solution requires a CA certificate, public key and private keys to hook into the SSL. For some reason, confluent does not provide these? – CertainlyNotAdrian Jun 16 '22 at 15:45
  • Confluent Cloud should provide SASL and SSL credentials, but that's not related to a DNS error. Might be better to reach out to confluent support – OneCricketeer Jun 17 '22 at 14:11

0 Answers0