We are using helm of prometheus operator chart stable, see this link for the source
and we use our values.yaml
which works OK, in the value.yaml we are configing prometheus (men cpu etc) and the alertmanger.
Now I need to add the prometheus alert manger config, but not sure how to provide it via the values.yaml (tried, it doesn’t work)
Any idea how to pass the config of the alert manager ?
This is the value.yaml
grafana:
enabled: true
alertmanager:
enabled: false
alertmanagerSpec:
replicas: 3
Now I need to provide in addition file which contain the alert manager rules
like the following:
file: alerts.yaml
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
creationTimestamp: null
labels:
prometheus: prometheus
role: alert-rules
name: prometheus-prometheus-rules
namespace: mon
spec:
groups:
- name: ./prometheus.rules
rules:
- alert: CRITICAL - nodes Disk Pressure
expr: 'kube_node_labels{label_workern_cloud_io_group=“ds"} * on(node)kube_node_status_condition{condition="DiskPressure", status="true"} == 1'
for: 5m
labels:
severity: CRITICAL
How should I pass also the alerts.yaml
via the helm installation ?
helm install prom stable/prometheus-operator -n mon -f values.yaml
should I create my own chart and put it on template ? if so how it’s recommended for clean implementation ?
There is no way to reference a external yaml file while running helm install
.
The best way to achieve this is to copy the chart and include it to templates folder.
From helm documentation we can read:
Templates
The most important piece of the puzzle is the templates/ directory. This is where Helm finds the YAML definitions for your Services, Deployments and other Kubernetes objects. If you already have definitions for your application, all you need to do is replace the generated YAML files for your own. What you end up with is a working chart that can be deployed using the helm install command.
$ git clone https://github.com/helm/charts.git
$ cp alerts.yaml ./charts/stable/prometheus-adapter/templates
$ helm install --name my-release stable/prometheus-adapter