-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadd-additional-prometheus-configs
44 lines (38 loc) · 1.22 KB
/
add-additional-prometheus-configs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
First, you will need to create the additional configuration. Below we are making a simple "prometheus" config. Name this prometheus-additional.yaml or something similar.
```
- job_name: "prometheus"
static_configs:
- targets: ["localhost:9090"]
```
Then you will need to make a secret out of this configuration.
```
oc create secret generic additional-scrape-configs --from-file=prometheus-additional.yaml --dry-run -oyaml > additional-scrape-configs.yaml
```
Next, create a new secret using the base64 encoded output as the value for prometheus-additional.yaml in the secret.
```
apiVersion: v1
data:
prometheus-additional.yaml: LSBqb2JfbmFtZTogInByb21ldGhldXMiCiAgc3RhdGljX2NvbmZpZ3M6CiAgLSB0YXJnZXRzOiBbImxvY2FsaG9zdDo5MDkwIl0K
kind: Secret
metadata:
creationTimestamp: null
name: additional-scrape-configs
```
Finally, reference this additional configuration in your prometheus.yaml CRD.
```
apiVersion: monitoring.coreos.com/v1
kind: Prometheus
metadata:
name: prometheus
labels:
prometheus: prometheus
spec:
replicas: 2
serviceAccountName: prometheus
serviceMonitorSelector:
matchLabels:
team: frontend
additionalScrapeConfigs:
name: additional-scrape-configs
key: prometheus-additional.yaml
...