From 2561dae9923ff3dd8720f2187990469a143d75ae Mon Sep 17 00:00:00 2001 From: Micah Nagel Date: Tue, 2 Mar 2021 14:16:19 -0700 Subject: [PATCH 1/3] wip monitoring --- chart/templates/minioinstance.yaml | 4 +++- chart/templates/role.yaml | 23 +++++++++++++++++++++++ chart/templates/rolebinding.yaml | 20 ++++++++++++++++++++ chart/templates/serviceMonitor.yaml | 25 +++++++++++++++++++++++++ chart/values.yaml | 4 +++- tests/test-values.yml | 6 +++++- 6 files changed, 79 insertions(+), 3 deletions(-) create mode 100644 chart/templates/role.yaml create mode 100644 chart/templates/rolebinding.yaml create mode 100644 chart/templates/serviceMonitor.yaml diff --git a/chart/templates/minioinstance.yaml b/chart/templates/minioinstance.yaml index 40306e6..17ba74f 100644 --- a/chart/templates/minioinstance.yaml +++ b/chart/templates/minioinstance.yaml @@ -78,7 +78,9 @@ spec: # operator: Equal # value: storage ## Add environment variables to be set in MinIO container (https://github.com/minio/minio/tree/master/docs/config) - # env: + env: + - name: MINIO_PROMETHEUS_AUTH_TYPE + value: "public" # - name: MINIO_BROWSER # value: "off" # to turn-off browser # - name: MINIO_STORAGE_CLASS_STANDARD diff --git a/chart/templates/role.yaml b/chart/templates/role.yaml new file mode 100644 index 0000000..a45547b --- /dev/null +++ b/chart/templates/role.yaml @@ -0,0 +1,23 @@ +{{- if .Values.monitoring.enabled }} +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleList +items: +- apiVersion: rbac.authorization.k8s.io/v1 + kind: Role + metadata: + name: prometheus-k8s + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/component: "monitoring" + rules: + - apiGroups: + - "" + resources: + - services + - endpoints + - pods + verbs: + - get + - list + - watch +{{- end }} diff --git a/chart/templates/rolebinding.yaml b/chart/templates/rolebinding.yaml new file mode 100644 index 0000000..ef303a8 --- /dev/null +++ b/chart/templates/rolebinding.yaml @@ -0,0 +1,20 @@ +{{- if .Values.monitoring.enabled }} +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBindingList +items: +- apiVersion: rbac.authorization.k8s.io/v1 + kind: RoleBinding + metadata: + name: prometheus-k8s + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/component: "monitoring" + roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: prometheus-k8s + subjects: + - kind: ServiceAccount + name: prometheus-k8s + namespace: {{ .Values.monitoring.namespace }} +{{- end }} diff --git a/chart/templates/serviceMonitor.yaml b/chart/templates/serviceMonitor.yaml new file mode 100644 index 0000000..cd0e896 --- /dev/null +++ b/chart/templates/serviceMonitor.yaml @@ -0,0 +1,25 @@ +{{- if .Values.monitoring.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + labels: + prometheus: k8s + release: monitoring + {{ include "minio.labels" . | nindent 4 }} + app.kubernetes.io/component: "monitoring" + name: minio-metrics + namespace: {{ .Release.Namespace }} +spec: + selector: + matchLabels: + v1.min.io/instance: minio-minio-instance + namespaceSelector: + matchNames: + - {{ .Release.Namespace }} + endpoints: + - interval: 30s + port: http-minio + scheme: http + path: /minio/v2/metrics/cluster + jobLabel: minio +{{- end }} diff --git a/chart/values.yaml b/chart/values.yaml index 1e6dff8..d381152 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -51,4 +51,6 @@ istio: enabled: true name: minio - +monitoring: + enabled: false + namespace: monitoring diff --git a/tests/test-values.yml b/tests/test-values.yml index 7640ac2..0347b81 100644 --- a/tests/test-values.yml +++ b/tests/test-values.yml @@ -22,4 +22,8 @@ volumeClaimTemplate: minioUICreds: default-minio-creds-secret imagePullSecrets: - - name: private-registry-mil \ No newline at end of file + - name: private-registry-mil + +monitoring: + enabled: false + namespace: monitoring -- GitLab From 81eb9162745efec800bedccf045e4a7fd04bc951 Mon Sep 17 00:00:00 2001 From: Micah Nagel Date: Tue, 2 Mar 2021 14:57:26 -0700 Subject: [PATCH 2/3] monitoring: fix endpoints, block on VS --- chart/templates/minio-vs.yaml | 18 +++++++++++++++++- chart/templates/serviceMonitor.yaml | 6 +++--- tests/test-values.yml | 8 ++++++++ 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/chart/templates/minio-vs.yaml b/chart/templates/minio-vs.yaml index 156e3d4..8d96f72 100644 --- a/chart/templates/minio-vs.yaml +++ b/chart/templates/minio-vs.yaml @@ -10,7 +10,23 @@ spec: hosts: - {{ .Values.istio.virtualService.name }}.{{ .Values.hostname }} http: - - route: + - match: + - uri: + prefix: /minio/prometheus/metrics + route: + - destination: + host: {{ include "minio.fullname" . }} + port: + number: {{ .Values.service.port }} + fault: + abort: + percentage: + value: 100 + httpStatus: 403 + - match: + - uri: + prefix: / + route: - destination: host: {{ include "minio.fullname" . }} port: diff --git a/chart/templates/serviceMonitor.yaml b/chart/templates/serviceMonitor.yaml index cd0e896..a9a1e57 100644 --- a/chart/templates/serviceMonitor.yaml +++ b/chart/templates/serviceMonitor.yaml @@ -12,14 +12,14 @@ metadata: spec: selector: matchLabels: - v1.min.io/instance: minio-minio-instance + {{- include "minio.selectorLabels" . | nindent 6 }} namespaceSelector: matchNames: - {{ .Release.Namespace }} endpoints: - interval: 30s - port: http-minio + port: http scheme: http - path: /minio/v2/metrics/cluster + path: /minio/prometheus/metrics jobLabel: minio {{- end }} diff --git a/tests/test-values.yml b/tests/test-values.yml index 0347b81..f73e391 100644 --- a/tests/test-values.yml +++ b/tests/test-values.yml @@ -24,6 +24,14 @@ minioUICreds: default-minio-creds-secret imagePullSecrets: - name: private-registry-mil +hostname: bigbang.dev + +istio: + enabled: true + virtualService: + enabled: true + name: minio + monitoring: enabled: false namespace: monitoring -- GitLab From 5617048a79f42e1e7f02b662bb18fdd07cbc72b5 Mon Sep 17 00:00:00 2001 From: Micah Nagel Date: Tue, 2 Mar 2021 15:01:53 -0700 Subject: [PATCH 3/3] bump chart --- chart/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chart/Chart.yaml b/chart/Chart.yaml index 2c94423..ded3213 100644 --- a/chart/Chart.yaml +++ b/chart/Chart.yaml @@ -9,7 +9,7 @@ description: |- type: application -version: 2.0.9-bb.2 +version: 2.0.9-bb.3 appVersion: 2.0.9 -- GitLab