diff --git a/custom-prometheus/prometheus-cluster-role-binding.yaml b/custom-prometheus/prometheus-cluster-role-binding.yaml deleted file mode 100644 index 714e50b..0000000 --- a/custom-prometheus/prometheus-cluster-role-binding.yaml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1beta1 -kind: ClusterRoleBinding -metadata: - name: prometheus - namespace: monitoring -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: prometheus -subjects: -- kind: ServiceAccount - name: prometheus - namespace: default diff --git a/custom-prometheus/prometheus-cluster-role.yaml b/custom-prometheus/prometheus-cluster-role.yaml deleted file mode 100644 index a85422e..0000000 --- a/custom-prometheus/prometheus-cluster-role.yaml +++ /dev/null @@ -1,18 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1beta1 -kind: ClusterRole -metadata: - name: prometheus -rules: -- apiGroups: [""] - resources: - - nodes - - services - - endpoints - - pods - verbs: ["get", "list", "watch"] -- apiGroups: [""] - resources: - - configmaps - verbs: ["get"] -- nonResourceURLs: ["/metrics"] - verbs: ["get"] diff --git a/custom-prometheus/prometheus-service-account.yaml b/custom-prometheus/prometheus-service-account.yaml deleted file mode 100644 index f3fb283..0000000 --- a/custom-prometheus/prometheus-service-account.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: v1 -kind: ServiceAccount -metadata: - name: prometheus diff --git a/custom-prometheus/prometheus.yaml b/custom-prometheus/prometheus.yaml index 0d38756..1c17671 100644 --- a/custom-prometheus/prometheus.yaml +++ b/custom-prometheus/prometheus.yaml @@ -8,7 +8,7 @@ metadata: spec: replicas: 1 version: v2.0.0-rc.3 - serviceAccountName: prometheus + serviceAccountName: prometheus-custom serviceMonitorSelector: alerting: alertmanagers: diff --git a/custom-prometheus/rbac.yaml b/custom-prometheus/rbac.yaml new file mode 100644 index 0000000..7699f9b --- /dev/null +++ b/custom-prometheus/rbac.yaml @@ -0,0 +1,48 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: prometheus-custom + namespace: monitoring + annotations: + manifest-origin: github.com/Yolean/kubernetes-monitoring +--- +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRole +metadata: + name: monitoring-by-prometheus-annotations + annotations: + manifest-origin: github.com/Yolean/kubernetes-monitoring +rules: +- apiGroups: [""] + resources: + - nodes + - services + - endpoints + - pods + verbs: ["get", "list", "watch"] +- apiGroups: [""] + resources: + - configmaps + verbs: ["get"] +- apiGroups: ["extensions"] + resources: + - ingresses + verbs: ["get", "list", "watch"] +- nonResourceURLs: ["/metrics"] + verbs: ["get"] +--- +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRoleBinding +metadata: + name: monitoring-by-prometheus-annotations + annotations: + manifest-origin: github.com/Yolean/kubernetes-monitoring +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: monitoring-by-prometheus-annotations +subjects: +- kind: ServiceAccount + name: prometheus-custom + namespace: monitoring