我需要使用Prometheus规则应用一些警报,以了解哪些Pod已重新启动以及哪些Pod已终止。我发现了一些特定于重新启动和终止Pod的规则,但是对此我有一些澄清。
例如:
groups:
- name: example-alert
rules:
# Alert about restarts
- alert: RestartAlerts
expr: count(kube_pod_container_status_restarts_total) by (pod-name) > 5
for: 10m
annotations:
summary: "More than 5 restarts in pod {{ $labels.pod-name }}"
description: "{{ $labels.container-name }} restarted (current value: {{ $value }}s) times in pod {{ $labels.pod-namespace }}/{{ $labels.pod-name }}"
因此,在这种情况下,我们如何知道pod-name,container-name。对于每一个新的部署,它们都可以更新。在这个示例中,它将如何工作?