To setup prometheus operator we can use the helm chart to do so
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
helm install monitoring prometheus-community/kube-prometheus-stack \
-n monitoring --create-namespace
And then create the prometheusRule to create an alert. The important thing here is the metadata: labels which needs to match the pod that you're trying to applied to. Regardless if this is a simple vector(1)==1 eample, it needs to match for the trigger gets generated.
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: always-firing
namespace: monitoring
labels:
release: monitoring
spec:
groups:
- name: test-alerts
rules:
- alert: AlwaysFiring
expr: vector(1) == 1
for: 0s
labels:
severity: critical
annotations:
summary: "This is a guaranteed firing alert"
description: "This alert always fires because 1 == 1."
And then you can see that the alert is coming out.
Comments