Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[kube-prometheus-stack] Increase alert threshold #5028

Open
vignesh-v3 opened this issue Nov 27, 2024 · 1 comment
Open

[kube-prometheus-stack] Increase alert threshold #5028

vignesh-v3 opened this issue Nov 27, 2024 · 1 comment

Comments

@vignesh-v3
Copy link

Hi there,
I am trying to increase the threshold for the alert in Kube Prometheus stack.
but some how i get an error for this line specifically as its not allowing me to use {{ $labels.name }}

            description: Kubernetes aggregated API {{ $labels.name }}/{{ $labels.namespace }} has reported errors. It has appeared unavailable {{ $value | humanize }} times averaged over the past 20m.

I have created this file

#helm-charts/kube-prometheus-stack/templates/prometheus-rules/kube-aggregated-api-errors.yaml
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
  name: kube-prometheus-stack-kubernetes-system-apiserver
  namespace: kube-prometheus-stack
  annotations:
    prometheus-operator-validated: "true"    # adjust namespace as needed
  labels:
    app: kube-prometheus-stack
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/part-of: kube-prometheus-stack
    app.kubernetes.io/version: 62.3.1
    chart: kube-prometheus-stack-62.3.1
    heritage: Helm
    release: kube-prometheus-stack
spec:
  groups:
    - name: kubernetes-system-apiserver
      rules:
        - alert: KubeAggregatedAPIErrors
          annotations:
            description: Kubernetes aggregated API {{ $labels.name }}/{{ $labels.namespace }} has reported errors. It has appeared unavailable {{ $value | humanize }} times averaged over the past 20m.
            runbook_url: https://runbooks.prometheus-operator.dev/runbooks/kubernetes/kubeaggregatedapierrors
            summary: Kubernetes aggregated API has reported errors.
          expr: |
            sum by (name, namespace, cluster)(increase(aggregator_unavailable_apiservice_total{job="apiserver"}[20m])) > 4
          labels:
            severity: warning    

Also i have the below values file which has got KubeAggregatedAPIErrors to true.

#helm-charts/kube-prometheus-stack/values.yaml
kube-prometheus-stack:
  defaultRules:
    rules:
      # Disabled since we don't manage control plane nodes in OKE.
      etcd: false
      kubeScheduler: false
      KubeAggregatedAPIErrors: true
@zeritti zeritti changed the title Increase the threshold [kube-prometheus-stack] Increase alert threshold Dec 4, 2024
@sebastiangaiser
Copy link
Contributor

sebastiangaiser commented Dec 13, 2024

kubernetes-monitoring/kubernetes-mixin#991 should fix your original problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants