I am trying to access kafka broker running at kafka-dev.net:9090 from a k8s pod.
The Go code I am using is from this example. https://github.com/Shopify/sarama/blob/main/examples/consumergroup/main.go
ctx, cancel := context.WithCancel(context.Background())
client, err := sarama.NewConsumerGroup(strings.Split(brokers, ","), group, config)
if err != nil {
log.Panicf("Error creating consumer group client: %v", err)
}
I got an error while creating a new client above. The error is :
"dial:tcp lookup kafka-dev.net: no such host"
Although i am able to access this from my local development setup The only problem is in the k8s pod. I am totally new to kubernetes and hence also not written the .yaml for kubernetes. In the k8s config 9090 port is nowhere defined. is it possible that my golang application within the pod is not able to access port 9090 outside of the pod? do i have to define it somewhere ?