-
Notifications
You must be signed in to change notification settings - Fork 3
/
custom-kube-prometheus.jsonnet
93 lines (89 loc) · 3.87 KB
/
custom-kube-prometheus.jsonnet
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
local kp =
(import 'kube-prometheus/kube-prometheus.libsonnet') +
// Uncomment the following imports to enable its patches
// (import 'kube-prometheus/kube-prometheus-anti-affinity.libsonnet') +
// (import 'kube-prometheus/kube-prometheus-managed-cluster.libsonnet') +
// (import 'kube-prometheus/kube-prometheus-node-ports.libsonnet') +
// (import 'kube-prometheus/kube-prometheus-static-etcd.libsonnet') +
// (import 'kube-prometheus/kube-prometheus-thanos-sidecar.libsonnet') +
{
_config+:: {
namespace: 'monitoring',
versions+:: {
alertmanager: "v0.20.0",
nodeExporter: "v0.18.1",
kubeStateMetrics: "v1.9.0",
kubeRbacProxy: "v0.4.1",
prometheusOperator: "v0.34.0",
prometheus: "v2.14.0",
grafana: '6.5.2',
},
imageRepos+:: {
prometheus: "quay.io/prometheus/prometheus",
alertmanager: "quay.io/prometheus/alertmanager",
kubeStateMetrics: "quay.io/coreos/kube-state-metrics",
kubeRbacProxy: "quay.io/coreos/kube-rbac-proxy",
nodeExporter: "quay.io/prometheus/node-exporter",
prometheusOperator: "quay.io/coreos/prometheus-operator",
grafana: 'grafana/grafana',
},
prometheus+:: {
name: 'k3s',
replicas: 1,
},
alertmanager+:: {
name: 'main',
config: |||
global:
resolve_timeout: 5m
route:
group_by: ['job']
group_wait: 30s
group_interval: 5m
repeat_interval: 12h
receiver: 'null'
routes:
- match:
alertname: Watchdog
receiver: 'null'
receivers:
- name: 'null'
|||,
replicas: 1,
},
grafana+:: {
config: {
sections: {
"auth": {disable_login_form: true,
disable_signout_menu: true},
"auth.anonymous": {enabled: false},
"auth.basic": {enabled: true},
"auth.proxy": {enabled: true,
header_name: "x-organizr-user",
header_property: "username",
auto_sign_up: true,
sync_ttl: 60,
whitelist: "0.0.0.0/0",
headers: "Email:X-User-Email, Name:X-User-Name"},
"users": {allow_sign_up: false,
auto_assign_org: true,
auto_assign_org_role: "Admin"},
"security": {disable_initial_admin_creation: true},
},
},
},
},
};
{ ['00-kube-prometheus/0namespace-' + name + '.json']: kp.kubePrometheus[name] for name in std.objectFields(kp.kubePrometheus) } +
{
['00-kube-prometheus/prometheus-operator-' + name + '.json']: kp.prometheusOperator[name]
for name in std.filter((function(name) name != 'serviceMonitor'), std.objectFields(kp.prometheusOperator))
} +
// serviceMonitor is separated so that it can be created after the CRDs are ready
{ '01-kube-prometheus/prometheus-operator-serviceMonitor.json': kp.prometheusOperator.serviceMonitor } +
{ ['01-kube-prometheus/node-exporter-' + name + '.json']: kp.nodeExporter[name] for name in std.objectFields(kp.nodeExporter) } +
{ ['01-kube-prometheus/kube-state-metrics-' + name + '.json']: kp.kubeStateMetrics[name] for name in std.objectFields(kp.kubeStateMetrics) } +
{ ['01-kube-prometheus/alertmanager-' + name + '.json']: kp.alertmanager[name] for name in std.objectFields(kp.alertmanager) } +
{ ['01-kube-prometheus/prometheus-' + name + '.json']: kp.prometheus[name] for name in std.objectFields(kp.prometheus) } +
{ ['01-kube-prometheus/prometheus-adapter-' + name + '.json']: kp.prometheusAdapter[name] for name in std.objectFields(kp.prometheusAdapter) } +
{ ['01-kube-prometheus/grafana-' + name + '.json']: kp.grafana[name] for name in std.objectFields(kp.grafana) }