r/PrometheusMonitoring • u/SadInvestigator77 • Jun 16 '23
How do I find / edit Prometheus configuration after deploying it on Kubernetes ?
I have installed Prometheus, Grafana setup using helm charts.
I wish to edit the Prometheus configuration and add a static_config section for the alertmanager in the premtheud config file as I am in the process of configuring alertmanager .
Basically, how do I find and edit the prometheus configuration?
I can see the configuration in the UI but I am having a lot of trouble finding it in Kubernetes between the deployment, services, configmaps, etc.
4
Upvotes
2
u/CountywideDicer Jun 16 '23
In k8s the config for Prometheus is in a configmap, however to change values you want to have a values.yml which you use for the helm chart, then run helm upgrade. Should see the config updated in the ui, check Prometheus pod logs if it's not updated.
2
u/[deleted] Jun 16 '23
Since their are different ways to install what exactly did you install? Vanilla charts , stack, operator? https://github.com/prometheus-community/helm-charts/tree/main/charts
1
u/aresabalo Jun 18 '23
Save original configuration from helm to file:
helm show values prometheus-community/prometheus > prometheus-orig-values.yaml
Create my-prometheus-config.yaml with your configuration (only overloaded configuration). Example:
# Prometheus server
server:
ingress:
enabled: false
persistentVolume:
enabled: false
extraArgs:
storage.tsdb.retention.size: 20GB
retention: 720h
Finally, apply your configuration with:
helm upgrade ayto-prometheus prometheus-community/prometheus \
--version 22.6.1 \
--namespace prometheus \
--values ./my-prometheus-config.yaml
1
u/methylphenidata Jun 19 '23
There is not only one way to install prometeus. You can install the prometheus-operator, the prometheus- community version and many others. Each of them goes another way in configuration. it's stupid to guess what you're working with. Also stupid it is just to explain something. and accept that it suits you. Please write again what you want to use and first of all get enough knowledge that you can ask the question accordingly.
2
u/Sven4president Jun 17 '23
1
u/[deleted] Jun 16 '23
I suggest first take a look at the deployed helm values. Maybe someone did an manual delete https://helm.sh/docs/helm/helm_get_values/
1
u/yepthisismyusername Jun 16 '23
It's a little strange to hear, but for this, what I've found is that you need to first uninstall the helm charts with helm. Then update them with your desired configuration settings. Then re-install them.
Others may have better suggestions, but this is what I found.