fix(kafka-operator): Kafka alert rules match only the old broker pod and PVC names

Đang mở
#5,303 0 bình luận 1 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 3 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
Nửa ngày
Mức phù hợp với người mới
42/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
helm, kafka, kubernetes, prometheus
Lĩnh vực
devops, observability

Hướng nghiên cứu

Start with packages/system/kafka-operator/alerts/prometheus-rules.yaml and check the pod and PVC regexes in KafkaRunningOutOfSpace, ScrapeProblem, KafkaBrokerContainersDown and KafkaContainerRestartedInTheLast5Minutes. Then look at packages/system/kafka-operator/templates/alerts.yaml, whose loop is commented out, and at kafka.brokerPoolName in packages/apps/kafka/templates/_versions.tpl for the b-<hash> naming. Done means the patterns match both pool styles and the package renders a PrometheusRule, which needs maintainer agreement on re-enabling.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

triage/needs-triage

The Kafka alert rules in the kafka-operator package only know the broker pool named kafka, so they miss every broker of a cluster with a release-hashed pool. Today the rules are not deployed at all, so this breaks the moment someone turns them back on.

The template that loads them is commented out. packages/system/kafka-operator/templates/alerts.yaml wraps its whole .Files.Glob "alerts/*.yaml" loop in a template comment since #790, and rendering the package gives no PrometheusRule. The rules still sit in packages/system/kafka-operator/alerts/prometheus-rules.yaml.

The rules select broker pods with .+-kafka-[0-9]+ and data PVCs with data(-[0-9]+)?-(.+)-kafka-[0-9]+. Only a cluster migrated from ZooKeeper keeps a broker pool named kafka. Every other cluster gets a broker pool named b-<hash> (see kafka.brokerPoolName in packages/apps/kafka/templates/_versions.tpl). Its pods are <cluster>-b-<hash>-N and its data PVCs are data-0-<cluster>-b-<hash>-N, and neither pattern matches them. The controller pool c-<hash> is not matched either.

With the rules enabled again, this is what happens:

  • KafkaRunningOutOfSpace and ScrapeProblem never fire for such a cluster.
  • KafkaBrokerContainersDown is absent(container_last_seen{container="kafka",pod=~".+-kafka-[0-9]+"}), so it fires all the time on a platform where no cluster has a kafka pool.
  • KafkaContainerRestartedInTheLast5Minutes compares all kafka containers with twice the matched ones, and the ratio is wrong once both pool styles exist.

This was already broken before the Strimzi 1.2 upgrade. The hashed pools came with support for several KRaft clusters per namespace, and the rules file did not change then.

Widening the broker patterns to (kafka|b-[0-9a-f]{8}) would fix the names. Matching on Strimzi labels may work better where the metric carries them. Turning the rules back on is a separate question from #790.

Ngôn ngữ chính
Go
Star
2.2k
Fork
209
Merge trung bình
4 ngày 14 giờ
Pull request đã merge (30 ngày)
140

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của cozystack/cozystack

Tất cả issue của cozystack/cozystack

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.