Ks 默认部署的Prometheus-Alertmanager 默认没有任务告警规则吗?
自动发现配置了ingress已经成功接入到Prometheus,设置告警时没有默认规则。这是其一! 其二是 告警规则 查了很多资料还是没有头绪!什么配置ServiceMonitor +PrometheusRule 都没有效果。
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: ingress-nginx-rules
namespace: ingress-nginx
labels:
prometheus: ingress-nginx
role: alert-rules
spec:
groups:
- name: ingress-nginx.rules
rules:
- alert: IngressNginxDown
annotations:
description: The Ingress NGINX controller has been down for more than 5 minutes.
summary: Ingress NGINX controller is down
expr: absent(up{job="ingress-nginx-controller"} == 1)
for: 5m
labels:
severity: critical
- alert: HighIngressNginxLatency annotations: description: 90th percentile request latency for Ingress NGINX is above 1 second for more than 10 minutes. summary: High latency for Ingress NGINX expr: histogram_quantile(0.9, sum(rate(nginx_ingress_controller_request_duration_seconds_bucket[5m])) by (le)) > 1 for: 10m labels: severity: warning---apiVersion: monitoring.coreos.com/v1kind: ServiceMonitormetadata: name: ingress-nginx namespace: kubesphere-monitoring-system labels: app.kubernetes.io/name: ingress-nginx app.kubernetes.io/part-of: kube-prometheus app.kubernetes.io/vendor: kubespherespec: endpoints: - port: metrics interval: 30s metricRelabelings: - action: drop regex: nginx_ingress_controller_request_duration_seconds_bucket sourceLabels: - __name__ jobLabel: app.kubernetes.io/name namespaceSelector: matchNames: - ingress-nginx selector: matchLabels: app.kubernetes.io/name: ingress-nginx