Search code examples
kubernetesapache-kafkastrimzi

Kubernetes - how to expose Kafka Exporter


I would like to monitor my kafka cluster with an external prometheus server. I successfully launch a Kafka cluster with Kafka Exporter on my kubernetes cluster, but in Strimzi configuration file, I do not find an option to expose the kafka exporter node. There is the only options I found : https://strimzi.io/docs/operators/latest/configuring.html#type-KafkaExporterSpec-reference

Someone already do this or have an idea ?


Solution

  • There is no built-in support for this in Strimzi. But you can create your own services (and/or Ingress resources for example) to do that.

    That said:

    • Keep in mind that the metrics endpoints are not secured in any way. So this will expose (potentially) confidential information such as topic names or consumer group names. It could be also used for some forms of DoS attacks. So you probably don't want to make it publicly available just like that and should consider the security aspect of this.
    • The Kafka Exporter is just a small part of the metrics. Other metrics are provided by the Kafka brokers or ZooKeeper nodes. So you might need to expose all of them.

    Overall, I think a common pattern for a situation like this is to collect the metrics locally instead of exposing them and then forward the metrics to the remote Prometheus metrics. I think the Prometheus Agent and Prometheus Federation might help with this as well as some other tools. So I think this is something you should consider instead.