-
Notifications
You must be signed in to change notification settings - Fork 241
/
Copy pathacm-prometheus-config.yaml
124 lines (124 loc) · 3.53 KB
/
acm-prometheus-config.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
# Copyright 2021 Google LLC
#
# 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.
# [START anthosconfig_config_sync_quickstart_monorepo_root_acm_monitor_service_account_prometheus_acm]
apiVersion: v1
kind: ServiceAccount
metadata:
name: prometheus-acm
namespace: monitoring
# [END anthosconfig_config_sync_quickstart_monorepo_root_acm_monitor_service_account_prometheus_acm]
---
# [START anthosconfig_config_sync_quickstart_monorepo_root_acm_monitor_cluster_role_prometheus_acm]
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: prometheus-acm
rules:
- apiGroups: [""]
resources:
- nodes
- services
- endpoints
- pods
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources:
- configmaps
verbs: ["get"]
- nonResourceURLs: ["/metrics"]
verbs: ["get"]
# [END anthosconfig_config_sync_quickstart_monorepo_root_acm_monitor_cluster_role_prometheus_acm]
---
# [START anthosconfig_config_sync_quickstart_monorepo_root_acm_monitor_cluster_role_binding_prometheus_acm]
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: prometheus-acm
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: prometheus-acm
subjects:
- kind: ServiceAccount
name: prometheus-acm
namespace: monitoring
# [END anthosconfig_config_sync_quickstart_monorepo_root_acm_monitor_cluster_role_binding_prometheus_acm]
---
# [START anthosconfig_config_sync_quickstart_monorepo_root_acm_monitor_prometheus]
apiVersion: monitoring.coreos.com/v1
kind: Prometheus
metadata:
name: acm
namespace: monitoring
labels:
prometheus: acm
spec:
replicas: 2
serviceAccountName: prometheus-acm
serviceMonitorSelector:
matchLabels:
prometheus: config-management
alerting:
alertmanagers:
- namespace: default
name: alertmanager
port: web
resources:
requests:
memory: 400Mi
# [END anthosconfig_config_sync_quickstart_monorepo_root_acm_monitor_prometheus]
---
# [START anthosconfig_config_sync_quickstart_monorepo_root_acm_monitor_service]
apiVersion: v1
kind: Service
metadata:
name: prometheus-acm
namespace: monitoring
labels:
prometheus: acm
spec:
type: NodePort
ports:
- name: web
nodePort: 31900
port: 9190
protocol: TCP
targetPort: web
selector:
app: prometheus
prometheus: acm
# [END anthosconfig_config_sync_quickstart_monorepo_root_acm_monitor_service]
---
# [START anthosconfig_config_sync_quickstart_monorepo_root_acm_monitor_service_monitor]
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: acm-service
namespace: monitoring
labels:
prometheus: config-management
spec:
selector:
matchLabels:
monitored: "true"
namespaceSelector:
matchNames:
# If you are using mono-repo mode, choose config-management-system
# If you are using multi-repo mode, choose config-management-monitoring
- config-management-system
# - config-management-monitoring
endpoints:
- port: metrics
interval: 10s
# [END anthosconfig_config_sync_quickstart_monorepo_root_acm_monitor_service_monitor]