This repository has been archived on 2024-12-15. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
onechart/website/docs/examples/prometheus-monitoring-rules.md
2020-10-14 13:36:39 +02:00

958 B

This page shows how you can add a PrometheusRule to your app deployment.

!!! Note This is a feature only supported by the kube-stack-prometheus stack (formerly known as the Prometheus Operator)

The following Prometheus rule alerts if a pod is crashlooping:

image:
  repository: nginx
  tag: 1.19.3

prometheusRules:
  - name: KubePodCrashLooping
    message: "Pod {{`{{`}} $labels.namespace {{`}}`}}/{{`{{`}} $labels.pod {{`}}`}} ({{`{{`}} $labels.container {{`}}`}}) is restarting {{`{{`}} printf \"%.2f\" $value {{`}}`}} times / 5 minutes."
    runBookURL: myrunbook.com
    expression: "rate(kube_pod_container_status_restarts_total{job=\"kube-state-metrics\", namespace=~\"{{ $targetNamespace }}\"}[15m]) * 60 * 5 > 0"
    for: 1h
    labels:
      severity: critical

Check the Kubernetes manifest:

helm template my-release onechart/onechart -f values.yaml