-1
C:\kafka>kubectl logs kafka-exporter-745f574c74-tzfn4
I0127 12:39:08.113890 1 kafka_exporter.go:792] Starting kafka_exporter (version=1.6.0, branch=master, revision=9d9cd654ca57e4f153d0d0b00ce36069b6a677c1)
F0127 12:39:08.890639 1 kafka_exporter.go:893] Error Init Kafka Client: kafka: client has run out of available brokers to talk to: dial tcp: lookup kafka.osm.svc.cluster.local on 10.96.0.10:53: no such host

below is the kafka-exporter-deployment.yaml file

apiVersion: apps/v1
kind: Deployment
metadata:
name: kafka-exporter
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: kafka-exporter
template:
metadata:
labels:
app: kafka-exporter
spec:
containers:
- name: kafka-exporter
image: danielqsj/kafka-exporter:latest
imagePullPolicy: IfNotPresent
args:
- --kafka.server=kafka.osm.svc.cluster.local:9092
- --web.listen-address=:9092
ports:
- containerPort: 9308
env:
- name: KAFKA_EXPORTER_KAFKA_CONNECT
value: kafka-broker-644794f4ff-8gmxb:9092
- name: KAFKA_EXPORTER_TOPIC_WHITELIST
value: samptopic

Kafka-exporter-service.yaml

apiVersion: v1
kind: Service
metadata:
name: kafka-exporter
namespace: default
spec:
selector:
app: kafka-exporter
ports:

name: http
port: 9308
targetPort: 9308
type: NodePort
OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
  • Well, can you show the services that **are running** in the `osm` namespace? Error says `kafka` isn't one of them. And do you really need both `KAFKA_EXPORTER_KAFKA_CONNECT` and `--kafka.server`? – OneCricketeer Jan 28 '23 at 02:05
  • Thanks for your reply.. actually there is no namespace called "osm" everything running on default namespace only .. and which one do u suggest "- --kafka.server=kafka.osm.svc.cluster.local:9092 - --web.listen-address=:9092" or - name: KAFKA_EXPORTER_KAFKA_CONNECT value: kafka-broker-644794f4ff-8gmxb:9092 for mentioning kafka server details so that i will go ahead and do the changes – Vijay Khanna Feb 01 '23 at 02:02
  • If there's no osm namespace, why are you using it as part of the DNS name? Where are those environment variables documented? I think you should remove both of them. Your web listen address also needs to be 9308, since that's your actual containerPort. And why not use Helm? https://github.com/danielqsj/kafka_exporter/tree/master/charts/kafka-exporter#helm-install – OneCricketeer Feb 01 '23 at 04:30

1 Answers1

0

actually there is no namespace called "osm" everything running on default namespace

Refer kubernetes documentation.

As the error says, there's no service kafka in an osm namespace (whether that exists, or not), that can be reached. Remove .osm from that address, or change it to .default, assuming that there really is a Service named kafka available at port 9092

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245