Forum Navigation
You need to log in to create posts and topics.

Prometheus on Kubernetes cannot edit rules configmap

Problem

User wants to change ( add / edit /delete  ) the configmap rules for promethues alerts

running the following command

kubectl edit configmap prometheus-kube-prometheus-stack-prometheus-rulefiles-0

allows you to see the alert rules but not to change them. any changes return to default

Solution

Starting from version 0.21 there are promethuesrule object you need to change

to see all the rules available

kubectl -n <NAMESPACE> get prometheusrule

to edit a rule

kubectl edit prometheusrule kube-prometheus-stack-general.rules

this will reflect to the configmap

scale down and up the deployment

kubectl scale deployment kube-prometheus-stack-operator –replicas=0

kubectl scale deployment kube-prometheus-stack-operator –replicas=1

 

 

Uploaded files:
If you have found my website, guides, articles or videos useful, please buy me a coffee