Forum archive › Kubernetes & Helm Charts
ArchivePrometheus 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
Attachment: command.txt
We do this for a living.
Kubernetes, DevOps and platform engineering, delivered in days — not another weekend lost to a stack trace.
Start a project →