Skip to content

Commit 5ad7dbb

Browse files
committed
rework grafana
closes #766
1 parent b61b727 commit 5ad7dbb

17 files changed

+17763
-11
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: 1
2+
providers:
3+
- name: 'default'
4+
orgId: 1
5+
folder: ''
6+
type: file
7+
disableDeletion: false
8+
editable: true
9+
options:
10+
path: /var/lib/grafana/dashboards
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# config file version
2+
apiVersion: 1
3+
# list of datasources that should be deleted from the database
4+
deleteDatasources:
5+
- name: prometheus
6+
orgId: 1
7+
# list of datasources to insert/update depending
8+
# whats available in the database
9+
datasources:
10+
# <string, required> name of the datasource. Required
11+
- name: prometheus
12+
# <string, required> datasource type. Required
13+
type: prometheus
14+
# <string, required> access mode. direct or proxy. Required
15+
access: proxy
16+
# <int> org id. will default to orgId 1 if not specified
17+
orgId: 1
18+
# <string> url
19+
url: https://<THANOS_QUERIER_HOST>
20+
# <bool> mark as default datasource. Max one per org
21+
isDefault: true
22+
# <map> fields that will be converted to json and stored in json_data
23+
jsonData:
24+
httpHeaderName1: 'Authorization'
25+
timeInterval: 5s
26+
tlsSkipVerify: true
27+
# <string> json object of data that will be encrypted.
28+
secureJsonData:
29+
httpHeaderValue1: 'Bearer <BEARER_TOKEN>'
30+
version: 1
31+
# <bool> allow users to edit datasources from the UI.
32+
editable: true
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# config file version
2+
apiVersion: 1
3+
# list of datasources that should be deleted from the database
4+
deleteDatasources:
5+
- name: prometheus
6+
orgId: 1
7+
# list of datasources to insert/update depending
8+
# whats available in the database
9+
datasources:
10+
# <string, required> name of the datasource. Required
11+
- name: prometheus
12+
# <string, required> datasource type. Required
13+
type: prometheus
14+
# <string, required> access mode. direct or proxy. Required
15+
access: proxy
16+
# <int> org id. will default to orgId 1 if not specified
17+
orgId: 1
18+
# <string> url
19+
url: http://px-prometheus:9090
20+
# <string> database password, if used
21+
password:
22+
# <string> database user, if used
23+
user:
24+
# <string> database name, if used
25+
database:
26+
# <bool> enable/disable basic auth
27+
basicAuth: true
28+
# <string> basic auth username
29+
basicAuthUser: admin
30+
# <string> basic auth password
31+
basicAuthPassword: foobar
32+
# <bool> enable/disable with credentials headers
33+
withCredentials:
34+
# <bool> mark as default datasource. Max one per org
35+
isDefault:
36+
# <map> fields that will be converted to json and stored in json_data
37+
jsonData:
38+
graphiteVersion: "1.1"
39+
tlsAuth: false
40+
tlsAuthWithCACert: false
41+
# <string> json object of data that will be encrypted.
42+
secureJsonData:
43+
tlsCACert: "..."
44+
tlsClientCert: "..."
45+
tlsClientKey: "..."
46+
version: 1
47+
# <bool> allow users to edit datasources from the UI.
48+
editable: true

assets/grafana/grafana-ocp.yaml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: grafana
5+
labels:
6+
app: grafana
7+
spec:
8+
type: ClusterIP
9+
ports:
10+
- port: 3000
11+
selector:
12+
app: grafana
13+
---
14+
apiVersion: apps/v1
15+
kind: Deployment
16+
metadata:
17+
name: grafana
18+
labels:
19+
app: grafana
20+
spec:
21+
replicas: 1
22+
selector:
23+
matchLabels:
24+
app: grafana
25+
template:
26+
metadata:
27+
labels:
28+
app: grafana
29+
spec:
30+
containers:
31+
- image: grafana/grafana:11.5.0
32+
name: grafana
33+
imagePullPolicy: IfNotPresent
34+
resources:
35+
limits:
36+
cpu: 2000m
37+
memory: 4Gi
38+
requests:
39+
cpu: 1000m
40+
memory: 2Gi
41+
readinessProbe:
42+
httpGet:
43+
path: /login
44+
port: 3000
45+
volumeMounts:
46+
- name: grafana-dash-config
47+
mountPath: /etc/grafana/provisioning/dashboards
48+
- name: dashboard-templates
49+
mountPath: /var/lib/grafana/dashboards
50+
- name: grafana-source-config
51+
mountPath: /etc/grafana/provisioning/datasources
52+
serviceAccountName: grafana
53+
volumes:
54+
- name: grafana-source-config
55+
configMap:
56+
name: grafana-source-config
57+
- name: grafana-dash-config
58+
configMap:
59+
name: grafana-dashboard-config
60+
- name: dashboard-templates
61+
configMap:
62+
name: grafana-dashboards
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: v1
2+
kind: ServiceAccount
3+
metadata:
4+
name: grafana

assets/grafana/grafana.yaml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: grafana
5+
labels:
6+
app: grafana
7+
spec:
8+
type: LoadBalancer
9+
ports:
10+
- port: 3000
11+
selector:
12+
app: grafana
13+
---
14+
apiVersion: apps/v1
15+
kind: Deployment
16+
metadata:
17+
name: grafana
18+
labels:
19+
app: grafana
20+
spec:
21+
replicas: 1
22+
selector:
23+
matchLabels:
24+
app: grafana
25+
template:
26+
metadata:
27+
labels:
28+
app: grafana
29+
spec:
30+
containers:
31+
- image: grafana/grafana:11.5.0
32+
name: grafana
33+
imagePullPolicy: IfNotPresent
34+
resources:
35+
limits:
36+
cpu: 100m
37+
memory: 100Mi
38+
requests:
39+
cpu: 100m
40+
memory: 100Mi
41+
readinessProbe:
42+
httpGet:
43+
path: /login
44+
port: 3000
45+
volumeMounts:
46+
- name: grafana-dash-config
47+
mountPath: /etc/grafana/provisioning/dashboards
48+
- name: dashboard-templates
49+
mountPath: /var/lib/grafana/dashboards
50+
- name: grafana-source-config
51+
mountPath: /etc/grafana/provisioning/datasources
52+
volumes:
53+
- name: grafana-source-config
54+
configMap:
55+
name: grafana-source-config
56+
- name: grafana-dash-config
57+
configMap:
58+
name: grafana-dashboard-config
59+
- name: dashboard-templates
60+
configMap:
61+
name: grafana-dashboards
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: monitoring.coreos.com/v1
2+
kind: ServiceMonitor
3+
metadata:
4+
name: node-exporter
5+
labels:
6+
prometheus: portworx
7+
spec:
8+
selector:
9+
matchLabels:
10+
name: node-exporter
11+
endpoints:
12+
- port: node-exporter
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
kind: Service
2+
apiVersion: v1
3+
metadata:
4+
name: node-exporter
5+
labels:
6+
name: node-exporter
7+
spec:
8+
selector:
9+
app.kubernetes.io/component: exporter
10+
app.kubernetes.io/name: node-exporter
11+
ports:
12+
- name: node-exporter
13+
protocol: TCP
14+
port: 9100
15+
targetPort: 9100

assets/grafana/node-exporter.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
apiVersion: apps/v1
2+
kind: DaemonSet
3+
metadata:
4+
labels:
5+
app.kubernetes.io/component: exporter
6+
app.kubernetes.io/name: node-exporter
7+
name: node-exporter
8+
spec:
9+
selector:
10+
matchLabels:
11+
app.kubernetes.io/component: exporter
12+
app.kubernetes.io/name: node-exporter
13+
template:
14+
metadata:
15+
labels:
16+
app.kubernetes.io/component: exporter
17+
app.kubernetes.io/name: node-exporter
18+
spec:
19+
containers:
20+
- args:
21+
- --path.sysfs=/host/sys
22+
- --path.rootfs=/host/root
23+
- --no-collector.wifi
24+
- --no-collector.hwmon
25+
- --collector.filesystem.ignored-mount-points=^/(dev|proc|sys|var/lib/docker/.+|var/lib/kubelet/pods/.+)($|/)
26+
- --collector.netclass.ignored-devices=^(veth.*)$
27+
name: node-exporter
28+
image: prom/node-exporter
29+
ports:
30+
- containerPort: 9100
31+
protocol: TCP
32+
resources:
33+
limits:
34+
cpu: 250m
35+
memory: 180Mi
36+
requests:
37+
cpu: 102m
38+
memory: 180Mi
39+
volumeMounts:
40+
- mountPath: /host/sys
41+
mountPropagation: HostToContainer
42+
name: sys
43+
readOnly: true
44+
- mountPath: /host/root
45+
mountPropagation: HostToContainer
46+
name: root
47+
readOnly: true
48+
volumes:
49+
- hostPath:
50+
path: /sys
51+
name: sys
52+
- hostPath:
53+
path: /
54+
name: root
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: cluster-monitoring-config
5+
namespace: openshift-monitoring
6+
data:
7+
config.yaml: |
8+
enableUserWorkload: true

0 commit comments

Comments
 (0)