blob: 93cd20aea451226bcabacecb6d205fd3eb989579 [file] [log] [blame]
vijaynag8339ed22019-07-25 17:10:58 +05301apiVersion: v1
2kind: Service
3metadata:
4 name: prometheus
5spec:
6 ports:
7 - nodePort: 9091
8 port: 9090
9 protocol: TCP
10 targetPort: 9090
11 selector:
12 app: prometheus
13 type: NodePort
14---
15apiVersion: v1
16data:
17 prometheus.yml: |
18 # Copyright 2018 The Prometheus Authors
19 # Copyright 2018 Whitestack
20 # Copyright 2018 Telefonica Investigacion y Desarrollo, S.A.U.
21 #
22 # Licensed under the Apache License, Version 2.0 (the "License");
23 # you may not use this file except in compliance with the License.
24 # You may obtain a copy of the License at
25 #
26 # http://www.apache.org/licenses/LICENSE-2.0
27 #
28 # Unless required by applicable law or agreed to in writing, software
29 # distributed under the License is distributed on an "AS IS" BASIS,
30 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31 # See the License for the specific language governing permissions and
32 # limitations under the License.
33
34 # my global config
35 global:
36 scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
37 evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
38 # scrape_timeout is set to the global default (10s).
39
40 # Alertmanager configuration
41 alerting:
42 alertmanagers:
43 - static_configs:
44 - targets:
45 # - alertmanager:9093
46
47 # Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
48 rule_files:
49 # - "first_rules.yml"
50 # - "second_rules.yml"
51
52 # A scrape configuration containing exactly one endpoint to scrape:
53 # Here it's Prometheus itself.
54 scrape_configs:
55 # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
lavado71906482020-04-13 17:02:00 -050056 - job_name: 'mon_exporter'
vijaynag8339ed22019-07-25 17:10:58 +053057
58 # metrics_path defaults to '/metrics'
59 # scheme defaults to 'http'.
60
61 static_configs:
62 - targets: ['mon:8000']
63kind: ConfigMap
64metadata:
65 name: prom
66---
67apiVersion: apps/v1
68kind: StatefulSet
69metadata:
70 name: prometheus
71 labels:
72 app: prometheus
73spec:
74 replicas: 1
75 serviceName: prometheus
76 selector:
77 matchLabels:
78 app: prometheus
79 template:
80 metadata:
81 labels:
82 app: prometheus
83 spec:
bravof6ba05912020-07-01 15:11:57 -040084 initContainers:
85 - name: prometheus-init-config
86 image: busybox
87 command: ["/bin/sh", "-c"]
bravof11a6fed2020-07-03 10:01:42 -040088 args: ['if [ ! -f "/etc/prometheus/prometheus.yml" ]; then cp /etc/prometheus_init/prometheus.yml /etc/prometheus; fi']
bravof6ba05912020-07-01 15:11:57 -040089 volumeMounts:
90 - name: prom-config
91 mountPath: /etc/prometheus
bravof11a6fed2020-07-03 10:01:42 -040092 - name: init-prom-config
93 mountPath: /etc/prometheus_init
vijaynag8339ed22019-07-25 17:10:58 +053094 containers:
95 - name: prometheus
96 image: prom/prometheus:v2.4.3
lavado71906482020-04-13 17:02:00 -050097 args:
98 - --config.file=/etc/prometheus/prometheus.yml
99 - --web.enable-lifecycle
vijaynag8339ed22019-07-25 17:10:58 +0530100 ports:
101 - containerPort: 9090
102 protocol: TCP
103 volumeMounts:
104 - name: prom-config
bravof6ba05912020-07-01 15:11:57 -0400105 mountPath: /etc/prometheus
vijaynag8339ed22019-07-25 17:10:58 +0530106 - name: prom-db
107 mountPath: /prometheus
108 volumes:
vijaynag8339ed22019-07-25 17:10:58 +0530109 - emptyDir: {}
110 name: prom-db
bravof6ba05912020-07-01 15:11:57 -0400111 - name: prom-config
112 hostPath:
113 path: /var/lib/osm/prometheus
bravof11a6fed2020-07-03 10:01:42 -0400114 - name: init-prom-config
115 configMap:
116 name: prom