Skip to content

Commit dfc4b88

Browse files
author
charlyF
committed
updating RBAC for prometheus
1 parent 414f9cd commit dfc4b88

File tree

1 file changed

+40
-1
lines changed
  • 02-path-working-with-clusters/201-cluster-monitoring/templates/prometheus

1 file changed

+40
-1
lines changed

02-path-working-with-clusters/201-cluster-monitoring/templates/prometheus/prometheus.yaml

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ metadata:
225225
spec:
226226
replicas: 2
227227
version: v2.0.0-rc.1
228-
serviceAccountName: prometheus-operator
228+
serviceAccountName: prometheus
229229
serviceMonitorSelector:
230230
matchExpressions:
231231
- {key: k8s-app, operator: Exists}
@@ -246,6 +246,45 @@ spec:
246246
name: alertmanager-main
247247
port: web
248248
---
249+
apiVersion: rbac.authorization.k8s.io/v1beta1
250+
kind: ClusterRole
251+
metadata:
252+
name: prometheus
253+
namespace: monitoring
254+
rules:
255+
- apiGroups: [""]
256+
resources:
257+
- nodes
258+
- services
259+
- endpoints
260+
- pods
261+
verbs: ["get", "list", "watch"]
262+
- apiGroups: [""]
263+
resources:
264+
- configmaps
265+
verbs: ["get"]
266+
- nonResourceURLs: ["/metrics"]
267+
verbs: ["get"]
268+
---
269+
apiVersion: v1
270+
kind: ServiceAccount
271+
metadata:
272+
name: prometheus
273+
namespace: monitoring
274+
---
275+
apiVersion: rbac.authorization.k8s.io/v1beta1
276+
kind: ClusterRoleBinding
277+
metadata:
278+
name: prometheus
279+
roleRef:
280+
apiGroup: rbac.authorization.k8s.io
281+
kind: ClusterRole
282+
name: prometheus
283+
subjects:
284+
- kind: ServiceAccount
285+
name: prometheus
286+
namespace: monitoring
287+
---
249288
apiVersion: monitoring.coreos.com/v1
250289
kind: ServiceMonitor
251290
metadata:

0 commit comments

Comments
 (0)