JMX is already enabled for broker pods (TODO extract to kustomization). There's many ways to use JMX. For example Kafka Manager uses it to display current broker traffic.
This folder adds a sidecar to the broker pods that exports selected JMX metrics over HTTP in Prometheus format. To add a container to an existing pod we must use the patch
command:
Using kubectl 1.14+
kubectl --namespace kafka apply -k prometheus/
Using pre-1.14 kubectl:
kubectl --namespace kafka apply -f prometheus/10-metrics-config.yml
kubectl --namespace kafka patch statefulset kafka --patch "$(cat prometheus/50-kafka-jmx-exporter-patch.yml )"
See Burrow or Kafka Minion
Use the prometheus-operator kustomization.