Newer
Older
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
# Copyright 2020 Minsait - Indra S.A.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Author: Jose Manuel Palacios (jmpalacios@minsait.com)
# Author: Alberto Limon (alimonj@minsait.com)
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
app: grafana
name: grafana-clusterrole
rules:
- apiGroups:
- ""
resources:
- configmaps
- secrets
verbs:
- get
- watch
- list
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
app: grafana
name: grafana-clusterrolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: grafana-clusterrole
subjects:
- kind: ServiceAccount
name: grafana
namespace: osm
---
apiVersion: v1
data:
admin-password: YWRtaW4=
admin-user: YWRtaW4=
kind: Secret
metadata:
labels:
app: grafana
name: grafana
type: Opaque
---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app: grafana
name: grafana
---
apiVersion: v1
data:
provider.yaml: |-
apiVersion: 1
providers:
- name: 'Kubernetes Cluster'
orgId: 1
folder: 'Kubernetes Cluster'
type: file
disableDeletion: false
options:
path: '/tmp/dashboards/Kubernetes Cluster'
- name: 'Open Source MANO'
orgId: 1
folder: 'Open Source MANO'
type: file
disableDeletion: false
options:
path: '/tmp/dashboards/Open Source MANO'
kind: ConfigMap
metadata:
labels:
app: grafana
name: grafana-dashboard-provider
---
apiVersion: v1
kind: ConfigMap
metadata:
labels:
grafana_datasource: "1"
name: grafana-datasource
data:
datasource.yaml: |-
apiVersion: 1
datasources:
- name: osm_prometheus
type: prometheus
url: http://prometheus:9090
access: proxy
allowUiUpdates: true
isDefault: true
- name: Prometheus
type: prometheus
url: http://osm-monitoring-prometheus-prometheus.monitoring:9090
access: proxy
allowUiUpdates: true
isDefault: false
---
apiVersion: v1
data:
grafana.ini: |
[log]
mode = console
[paths]
data = /var/lib/grafana/data
logs = /var/log/grafana
plugins = /var/lib/grafana/plugins
provisioning = /etc/grafana/provisioning
kind: ConfigMap
metadata:
labels:
app: grafana
name: grafana
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: grafana
name: grafana
spec:
replicas: 1
selector:
matchLabels:
app: grafana
template:
metadata:
labels:
app: grafana
spec:
containers:
- env:
- name: LABEL
value: grafana_dashboard
- name: FOLDER
value: "/tmp/dashboards/Kubernetes Cluster"
- name: RESOURCE
value: both
- name: NAMESPACE
value: monitoring
image: kiwigrid/k8s-sidecar:0.1.20
imagePullPolicy: IfNotPresent
name: grafana-sc-dashboard
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: "/tmp/dashboards/Kubernetes Cluster"
name: sc-dashboard-volume-k8s
- mountPath: "/tmp/dashboards/Open Source MANO"
name: sc-dashboard-volume-osm
- env:
- name: GF_SECURITY_ADMIN_USER
valueFrom:
secretKeyRef:
key: admin-user
name: grafana
- name: GF_SECURITY_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
key: admin-password
name: grafana
image: grafana/grafana:6.3.5
imagePullPolicy: IfNotPresent
livenessProbe:
failureThreshold: 10
httpGet:
path: /api/health
port: 3000
scheme: HTTP
initialDelaySeconds: 60
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 30
name: grafana
ports:
- containerPort: 80
name: service
protocol: TCP
- containerPort: 3000
name: grafana
protocol: TCP
readinessProbe:
failureThreshold: 3
httpGet:
path: /api/health
port: 3000
scheme: HTTP
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /etc/grafana/grafana.ini
name: config
subPath: grafana.ini
- mountPath: /var/lib/grafana
name: storage
- mountPath: "/tmp/dashboards/Kubernetes Cluster"
name: sc-dashboard-volume-k8s
- mountPath: "/tmp/dashboards/Open Source MANO"
name: sc-dashboard-volume-osm
- mountPath: /etc/grafana/provisioning/dashboards/sc-dashboardproviders.yaml
name: sc-dashboard-provider
subPath: provider.yaml
- mountPath: /etc/grafana/provisioning/datasources
name: sc-datasources-volume
dnsPolicy: ClusterFirst
initContainers:
- env:
- name: METHOD
value: LIST
- name: LABEL
value: grafana_datasource
- name: FOLDER
value: /etc/grafana/provisioning/datasources
- name: RESOURCE
value: both
image: kiwigrid/k8s-sidecar:0.1.20
imagePullPolicy: IfNotPresent
name: grafana-sc-datasources
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /etc/grafana/provisioning/datasources
name: sc-datasources-volume
restartPolicy: Always
schedulerName: default-scheduler
securityContext:
fsGroup: 472
runAsUser: 472
serviceAccount: grafana
serviceAccountName: grafana
terminationGracePeriodSeconds: 30
volumes:
- configMap:
defaultMode: 420
name: grafana
name: config
- emptyDir: {}
name: storage
- emptyDir: {}
name: sc-dashboard-volume-k8s
- emptyDir: {}
name: sc-dashboard-volume-osm
- configMap:
defaultMode: 420
name: grafana-dashboard-provider
name: sc-dashboard-provider
- emptyDir: {}
name: sc-datasources-volume
---
apiVersion: v1
kind: Service
metadata:
labels:
app: grafana
name: grafana
spec:
ports:
- name: service
nodePort: 3000
port: 3000
protocol: TCP
targetPort: 3000
selector:
app: grafana
sessionAffinity: None
type: NodePort