Skip to content
This repository was archived by the owner on Mar 26, 2025. It is now read-only.
This repository was archived by the owner on Mar 26, 2025. It is now read-only.

istio merged metrics cannot be used #1060

@vitalii-buchyn-exa

Description

@vitalii-buchyn-exa

Description

Hello community,

We are experiencing an issue with scraping istio merged metrics with enablePrometheusMerge istio feature.
In order to pull metrics by a pilot we need to add prometheus annotations to a brokerAnnotations spec of KafkaCluster object, like:

      brokerAnnotations:
        prometheus.io/path: /metrics
        prometheus.io/scrape: "true"
        prometheus.io/port: "9020"

This should result in a following env var for istio-proxy sidecar:

$ echo $ISTIO_PROMETHEUS_ANNOTATIONS
{"scrape":"true","path":"/metrics","port":"9020"}

The problem is that istio webhook overrides those annotations for a pod to make a merged metrics endpoint available for prometheus, like:

apiVersion: v1
kind: Pod
metadata:
  annotations:
    kubectl.kubernetes.io/default-container: kafka
    kubectl.kubernetes.io/default-logs-container: kafka
    prometheus.io/path: /stats/prometheus
    prometheus.io/port: "15020"
    prometheus.io/scrape: "true"

That webhook override causes koperator to instantly restart brokers.

Please let me know if any additional info is required.

Regards,
Vitalii

Expected Behavior

Maybe ignore istio specific prometheus annotations.
Yes, this will require manual brokers restart when prometheus config changes in kafkacluster object.

Actual Behavior

Continious pods restart.

Affected Version

kafka-operator:v0.22.0
banzaicloud-kafka:2.13-2.7.0-bzc.2
banzaicloud-cruise-control:2.5.101
jmx-exporter: banzaicloud-jmx-javaagent:0.14.0
cruise-control:2.5.101

Checklist

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions