-
Notifications
You must be signed in to change notification settings - Fork 18
/
prometheus.yaml
151 lines (140 loc) · 3.48 KB
/
prometheus.yaml
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{gitops.app}}
namespace: {{gitops.namespace}}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{gitops.app}}
rules:
- apiGroups: [""]
resources:
- nodes
- nodes/proxy
- services
- endpoints
- pods
verbs: ["get", "list", "watch"]
- apiGroups:
- extensions
resources:
- ingresses
verbs: ["get", "list", "watch"]
- nonResourceURLs: ["/metrics"]
verbs: ["get"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{gitops.app}}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{gitops.app}}
subjects:
- kind: ServiceAccount
name: {{gitops.app}}
namespace: {{gitops.namespace}}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{gitops.app}}-server-conf
labels:
name: {{gitops.app}}-server-conf
namespace: {{gitops.namespace}}
data:
prometheus.yml: |-
global:
scrape_interval: 5s
evaluation_interval: 5s
external_labels:
origin_prometheus: {{gitops.cluster.name}}
remote_write:
- url: {{gitops.prometheusURL}}
basic_auth:
username: {{gitops.prometheusUser}}
password_file: /etc/prometheus/secrets/prometheus.key
scrape_configs:
- job_name: 'webv-heartbeat'
static_configs:
- targets: [ 'webv-heartbeat.monitoring.svc.cluster.local:8080' ]
metric_relabel_configs:
- source_labels: [ __name__ ]
regex: "WebVDuration_count|WebVSummary|WebVSummary_count"
action: keep
- job_name: 'webv-imdb'
static_configs:
- targets: [ 'webv-imdb.monitoring.svc.cluster.local:8080' ]
metric_relabel_configs:
- source_labels: [ __name__ ]
regex: "WebVDuration_count|WebVSummary|WebVSummary_count"
action: keep
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{gitops.app}}-deployment
namespace: {{gitops.namespace}}
labels:
app: {{gitops.app}}-server
spec:
replicas: 1
selector:
matchLabels:
app: {{gitops.app}}-server
template:
metadata:
labels:
app: {{gitops.app}}-server
spec:
containers:
- name: {{gitops.app}}
image: {{gitops.image}}
args:
- "--storage.tsdb.retention.time=12h"
- "--config.file=/etc/prometheus/prometheus.yml"
- "--storage.tsdb.path=/prometheus/"
ports:
- containerPort: 9090
resources:
requests:
cpu: 250m
memory: 250M
limits:
cpu: 500M
memory: 500M
volumeMounts:
- name: prometheus-config-volume
mountPath: /etc/prometheus/
- name: prometheus-storage-volume
mountPath: /prometheus/
- name: prometheus-secret-volume
mountPath: /etc/prometheus/secrets
volumes:
- name: prometheus-config-volume
configMap:
defaultMode: 420
name: prometheus-server-conf
- name: prometheus-secret-volume
secret:
secretName: prom-secrets
- name: prometheus-storage-volume
emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
name: {{gitops.app}}-service
namespace: {{gitops.namespace}}
annotations:
prometheus.io/scrape: 'true'
prometheus.io/port: '9090'
spec:
selector:
app: {{gitops.app}}-server
ports:
- port: 8080
targetPort: 9090