This example shows how to deploy and view alerting rules in Kyma.
- Kyma as the target deployment environment.
- Deployed custom kube-prometheus-stack as described in the prometheus example.
-
Create the PrometheusRule resource holding the configuration of your alerting rule.
kubectl apply -f https://raw.githubusercontent.com/kyma-project/examples/main/prometheus/monitoring-alert-rules/deployment/alert-rule.yaml
-
Run the
port-forward
command on themonitoring-prometheus
service to access the Prometheus dashboard.kubectl -n ${K8S_NAMESPACE} port-forward $(kubectl -n ${K8S_NAMESPACE} get service -l app=kube-prometheus-stack-prometheus -oname) 9090
-
Go to
http://localhost:9090/rules
and find the pod-not-running rule.Because the
http-db-service
Deployment does not exist, Alertmanager fires an alert listed athttp://localhost:9090/alerts
.
-
Export your Namespace as a variable:
export K8S_NAMESPACE="{namespace}"
-
To stop the alert from getting fired, create the Deployment:
kubectl apply -f https://raw.githubusercontent.com/kyma-project/examples/main/http-db-service/deployment/deployment.yaml -n $K8S_NAMESPACE
Run the following commands to completely remove the example and all its resources from the cluster:
-
Remove the pod-not-running alerting rule from the cluster:
kubectl delete cm -n kyma-system -l example=monitoring-alert-rules
-
Remove the http-db-service example and all its resources from the cluster:
kubectl delete all -l example=http-db-service -n $K8S_NAMESPACE