Browse Source

Helm chart monitoring improvements (#3406)

pull/3408/head
ginn13 2 years ago
committed by GitHub
parent
commit
28a1f42962
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 75
      k8s/helm_charts2/dashboards/seaweedfs-grafana-dashboard.json
  2. 6
      k8s/helm_charts2/templates/filer-service.yaml
  3. 7
      k8s/helm_charts2/templates/filer-servicemonitor.yaml
  4. 4
      k8s/helm_charts2/templates/filer-statefulset.yaml
  5. 6
      k8s/helm_charts2/templates/master-service.yaml
  6. 21
      k8s/helm_charts2/templates/master-servicemonitor.yaml
  7. 14
      k8s/helm_charts2/templates/master-statefulset.yaml
  8. 4
      k8s/helm_charts2/templates/s3-deployment.yaml
  9. 7
      k8s/helm_charts2/templates/s3-servicemonitor.yaml
  10. 2
      k8s/helm_charts2/templates/volume-service.yaml
  11. 7
      k8s/helm_charts2/templates/volume-servicemonitor.yaml
  12. 8
      k8s/helm_charts2/templates/volume-statefulset.yaml
  13. 1
      k8s/helm_charts2/values.yaml
  14. 14
      other/metrics/grafana_seaweedfs_k8s.json

75
k8s/helm_charts2/dashboards/seaweedfs-grafana-dashboard.json

@ -1,14 +1,5 @@
{ {
"__inputs": [
{
"name": "DS_PROMETHEUS-DEV",
"label": "prometheus-dev",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
}
],
"__inputs": [],
"__requires": [ "__requires": [
{ {
"type": "grafana", "type": "grafana",
@ -33,7 +24,7 @@
"list": [ "list": [
{ {
"builtIn": 1, "builtIn": 1,
"datasource": "${DS_PROMETHEUS-DEV}",
"datasource": "${DS_PROMETHEUS}",
"enable": true, "enable": true,
"hide": true, "hide": true,
"iconColor": "rgba(0, 211, 255, 1)", "iconColor": "rgba(0, 211, 255, 1)",
@ -61,7 +52,7 @@
"bars": false, "bars": false,
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": "${DS_PROMETHEUS-DEV}",
"datasource": "${DS_PROMETHEUS}",
"editable": true, "editable": true,
"error": false, "error": false,
"fill": 1, "fill": 1,
@ -151,7 +142,7 @@
"bars": false, "bars": false,
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": "${DS_PROMETHEUS-DEV}",
"datasource": "${DS_PROMETHEUS}",
"editable": true, "editable": true,
"error": false, "error": false,
"fill": 1, "fill": 1,
@ -247,7 +238,7 @@
"bars": false, "bars": false,
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": "${DS_PROMETHEUS-DEV}",
"datasource": "${DS_PROMETHEUS}",
"editable": true, "editable": true,
"error": false, "error": false,
"fill": 1, "fill": 1,
@ -343,7 +334,7 @@
"bars": false, "bars": false,
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": "${DS_PROMETHEUS-DEV}",
"datasource": "${DS_PROMETHEUS}",
"editable": true, "editable": true,
"error": false, "error": false,
"fill": 0, "fill": 0,
@ -448,7 +439,7 @@
"bars": false, "bars": false,
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": "${DS_PROMETHEUS-DEV}",
"datasource": "${DS_PROMETHEUS}",
"editable": true, "editable": true,
"error": false, "error": false,
"fill": 1, "fill": 1,
@ -538,7 +529,7 @@
"bars": false, "bars": false,
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": "${DS_PROMETHEUS-DEV}",
"datasource": "${DS_PROMETHEUS}",
"editable": true, "editable": true,
"error": false, "error": false,
"fill": 1, "fill": 1,
@ -628,7 +619,7 @@
"bars": false, "bars": false,
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": "${DS_PROMETHEUS-DEV}",
"datasource": "${DS_PROMETHEUS}",
"editable": true, "editable": true,
"error": false, "error": false,
"fill": 1, "fill": 1,
@ -718,7 +709,7 @@
"bars": false, "bars": false,
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": "${DS_PROMETHEUS-DEV}",
"datasource": "${DS_PROMETHEUS}",
"editable": true, "editable": true,
"error": false, "error": false,
"fill": 0, "fill": 0,
@ -811,7 +802,7 @@
"bars": false, "bars": false,
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": "${DS_PROMETHEUS-DEV}",
"datasource": "${DS_PROMETHEUS}",
"editable": true, "editable": true,
"error": false, "error": false,
"fill": 0, "fill": 0,
@ -943,7 +934,7 @@
"bars": false, "bars": false,
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": "${DS_PROMETHEUS-DEV}",
"datasource": "${DS_PROMETHEUS}",
"editable": true, "editable": true,
"error": false, "error": false,
"fill": 1, "fill": 1,
@ -1031,7 +1022,7 @@
"bars": false, "bars": false,
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": "${DS_PROMETHEUS-DEV}",
"datasource": "${DS_PROMETHEUS}",
"editable": true, "editable": true,
"error": false, "error": false,
"fill": 1, "fill": 1,
@ -1117,7 +1108,7 @@
"bars": false, "bars": false,
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": "${DS_PROMETHEUS-DEV}",
"datasource": "${DS_PROMETHEUS}",
"fill": 1, "fill": 1,
"id": 48, "id": 48,
"legend": { "legend": {
@ -1200,7 +1191,7 @@
"bars": false, "bars": false,
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": "${DS_PROMETHEUS-DEV}",
"datasource": "${DS_PROMETHEUS}",
"fill": 1, "fill": 1,
"id": 50, "id": 50,
"legend": { "legend": {
@ -1283,7 +1274,7 @@
"bars": false, "bars": false,
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": "${DS_PROMETHEUS-DEV}",
"datasource": "${DS_PROMETHEUS}",
"fill": 1, "fill": 1,
"id": 51, "id": 51,
"legend": { "legend": {
@ -1371,7 +1362,7 @@
"bars": false, "bars": false,
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": "${DS_PROMETHEUS-DEV}",
"datasource": "${DS_PROMETHEUS}",
"editable": true, "editable": true,
"error": false, "error": false,
"fill": 1, "fill": 1,
@ -1451,7 +1442,7 @@
"bars": false, "bars": false,
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": "${DS_PROMETHEUS-DEV}",
"datasource": "${DS_PROMETHEUS}",
"editable": true, "editable": true,
"error": false, "error": false,
"fill": 1, "fill": 1,
@ -1546,7 +1537,7 @@
"bars": false, "bars": false,
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": "${DS_PROMETHEUS-DEV}",
"datasource": "${DS_PROMETHEUS}",
"editable": true, "editable": true,
"error": false, "error": false,
"fill": 1, "fill": 1,
@ -1651,7 +1642,7 @@
"bars": false, "bars": false,
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": "${DS_PROMETHEUS-DEV}",
"datasource": "${DS_PROMETHEUS}",
"editable": true, "editable": true,
"error": false, "error": false,
"fill": 1, "fill": 1,
@ -1731,7 +1722,7 @@
"bars": false, "bars": false,
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": "${DS_PROMETHEUS-DEV}",
"datasource": "${DS_PROMETHEUS}",
"editable": true, "editable": true,
"error": false, "error": false,
"fill": 1, "fill": 1,
@ -1819,7 +1810,29 @@
"style": "dark", "style": "dark",
"tags": [], "tags": [],
"templating": { "templating": {
"list": []
"list": [
{
"current": {
"selected": true,
"text": "Prometheus",
"value": "Prometheus"
},
"description": null,
"error": null,
"hide": 0,
"includeAll": false,
"label": "Datasource",
"multi": false,
"name": "DS_PROMETHEUS",
"options": [],
"query": "prometheus",
"queryValue": "",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"type": "datasource"
}
]
}, },
"time": { "time": {
"from": "now-30d", "from": "now-30d",

6
k8s/helm_charts2/templates/filer-service.yaml

@ -20,6 +20,12 @@ spec:
port: {{ .Values.filer.grpcPort }} port: {{ .Values.filer.grpcPort }}
targetPort: {{ .Values.filer.grpcPort }} targetPort: {{ .Values.filer.grpcPort }}
protocol: TCP protocol: TCP
{{- if .Values.filer.metricsPort }}
- name: "metrics"
port: {{ .Values.filer.metricsPort }}
targetPort: {{ .Values.filer.metricsPort }}
protocol: TCP
{{- end }}
selector: selector:
app: {{ template "seaweedfs.name" . }} app: {{ template "seaweedfs.name" . }}
component: filer component: filer

7
k8s/helm_charts2/templates/filer-servicemonitor.yaml

@ -11,10 +11,11 @@ metadata:
spec: spec:
endpoints: endpoints:
- interval: 30s - interval: 30s
port: swfs-filer-metrics
port: metrics
scrapeTimeout: 5s scrapeTimeout: 5s
selector: selector:
app: {{ template "seaweedfs.name" . }}
component: filer
matchLabels:
app: {{ template "seaweedfs.name" . }}
component: filer
{{- end }} {{- end }}
{{- end }} {{- end }}

4
k8s/helm_charts2/templates/filer-statefulset.yaml

@ -110,7 +110,7 @@ spec:
filer \ filer \
-port={{ .Values.filer.port }} \ -port={{ .Values.filer.port }} \
{{- if .Values.filer.metricsPort }} {{- if .Values.filer.metricsPort }}
-metricsPort {{ .Values.filer.metricsPort }} \
-metricsPort={{ .Values.filer.metricsPort }} \
{{- end }} {{- end }}
{{- if .Values.filer.redirectOnRead }} {{- if .Values.filer.redirectOnRead }}
-redirectOnRead \ -redirectOnRead \
@ -193,6 +193,8 @@ spec:
ports: ports:
- containerPort: {{ .Values.filer.port }} - containerPort: {{ .Values.filer.port }}
name: swfs-filer name: swfs-filer
- containerPort: {{ .Values.filer.metricsPort }}
name: metrics
- containerPort: {{ .Values.filer.grpcPort }} - containerPort: {{ .Values.filer.grpcPort }}
#name: swfs-filer-grpc #name: swfs-filer-grpc
readinessProbe: readinessProbe:

6
k8s/helm_charts2/templates/master-service.yaml

@ -20,6 +20,12 @@ spec:
port: {{ .Values.master.grpcPort }} port: {{ .Values.master.grpcPort }}
targetPort: {{ .Values.master.grpcPort }} targetPort: {{ .Values.master.grpcPort }}
protocol: TCP protocol: TCP
{{- if .Values.master.metricsPort }}
- name: "metrics"
port: {{ .Values.master.metricsPort }}
targetPort: {{ .Values.master.metricsPort }}
protocol: TCP
{{- end }}
selector: selector:
app: {{ template "seaweedfs.name" . }} app: {{ template "seaweedfs.name" . }}
component: master component: master

21
k8s/helm_charts2/templates/master-servicemonitor.yaml

@ -0,0 +1,21 @@
{{- if .Values.master.metricsPort }}
{{- if .Values.global.monitoring.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "seaweedfs.name" . }}-master
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "seaweedfs.name" . }}
component: master
spec:
endpoints:
- interval: 30s
port: metrics
scrapeTimeout: 5s
selector:
matchLabels:
app: {{ template "seaweedfs.name" . }}
component: master
{{- end }}
{{- end }}

14
k8s/helm_charts2/templates/master-statefulset.yaml

@ -109,7 +109,14 @@ spec:
-volumePreallocate \ -volumePreallocate \
{{- end }} {{- end }}
{{- if .Values.global.monitoring.enabled }} {{- if .Values.global.monitoring.enabled }}
{{- if and .Values.global.monitoring.gatewayHost .Values.global.monitoring.gatewayPort }}
-metrics.address="{{ .Values.global.monitoring.gatewayHost }}:{{ .Values.global.monitoring.gatewayPort }}" \ -metrics.address="{{ .Values.global.monitoring.gatewayHost }}:{{ .Values.global.monitoring.gatewayPort }}" \
{{- if .Values.master.metricsIntervalSec }}
-metrics.intervalSeconds={{ .Values.master.metricsIntervalSec }} \
{{- end }}
{{- else if .Values.master.metricsPort }}
-metricsPort={{ .Values.master.metricsPort }} \
{{- end }}
{{- end }} {{- end }}
-volumeSizeLimitMB={{ .Values.master.volumeSizeLimitMB }} \ -volumeSizeLimitMB={{ .Values.master.volumeSizeLimitMB }} \
{{- if .Values.master.disableHttp }} {{- if .Values.master.disableHttp }}
@ -121,9 +128,6 @@ spec:
{{- if .Values.master.garbageThreshold }} {{- if .Values.master.garbageThreshold }}
-garbageThreshold={{ .Values.master.garbageThreshold }} \ -garbageThreshold={{ .Values.master.garbageThreshold }} \
{{- end }} {{- end }}
{{- if .Values.master.metricsIntervalSec }}
-metrics.intervalSeconds={{ .Values.master.metricsIntervalSec }} \
{{- end }}
-ip=${POD_NAME}.${SEAWEEDFS_FULLNAME}-master \ -ip=${POD_NAME}.${SEAWEEDFS_FULLNAME}-master \
-peers={{ range $index := until (.Values.master.replicas | int) }}${SEAWEEDFS_FULLNAME}-master-{{ $index }}.${SEAWEEDFS_FULLNAME}-master:{{ $.Values.master.port }}{{ if lt $index (sub ($.Values.master.replicas | int) 1) }},{{ end }}{{ end }} -peers={{ range $index := until (.Values.master.replicas | int) }}${SEAWEEDFS_FULLNAME}-master-{{ $index }}.${SEAWEEDFS_FULLNAME}-master:{{ $.Values.master.port }}{{ if lt $index (sub ($.Values.master.replicas | int) 1) }},{{ end }}{{ end }}
volumeMounts: volumeMounts:
@ -156,6 +160,10 @@ spec:
ports: ports:
- containerPort: {{ .Values.master.port }} - containerPort: {{ .Values.master.port }}
name: swfs-master name: swfs-master
{{- if and .Values.global.monitoring.enabled .Values.master.metricsPort }}
- containerPort: {{ .Values.master.metricsPort }}
name: metrics
{{- end }}
- containerPort: {{ .Values.master.grpcPort }} - containerPort: {{ .Values.master.grpcPort }}
#name: swfs-master-grpc #name: swfs-master-grpc
readinessProbe: readinessProbe:

4
k8s/helm_charts2/templates/s3-deployment.yaml

@ -131,6 +131,10 @@ spec:
ports: ports:
- containerPort: {{ .Values.s3.port }} - containerPort: {{ .Values.s3.port }}
name: swfs-s3 name: swfs-s3
{{- if .Values.s3.metricsPort }}
- containerPort: {{ .Values.s3.metricsPort }}
name: "metrics"
{{- end }}
readinessProbe: readinessProbe:
httpGet: httpGet:
path: /status path: /status

7
k8s/helm_charts2/templates/s3-servicemonitor.yaml

@ -11,10 +11,11 @@ metadata:
spec: spec:
endpoints: endpoints:
- interval: 30s - interval: 30s
port: swfs-s3-metrics
port: metrics
scrapeTimeout: 5s scrapeTimeout: 5s
selector: selector:
app: {{ template "seaweedfs.name" . }}
component: s3
matchLabels:
app: {{ template "seaweedfs.name" . }}
component: s3
{{- end }} {{- end }}
{{- end }} {{- end }}

2
k8s/helm_charts2/templates/volume-service.yaml

@ -18,7 +18,7 @@ spec:
targetPort: {{ .Values.volume.grpcPort }} targetPort: {{ .Values.volume.grpcPort }}
protocol: TCP protocol: TCP
{{- if .Values.volume.metricsPort }} {{- if .Values.volume.metricsPort }}
- name: "swfs-volume-metrics"
- name: "metrics"
port: {{ .Values.volume.metricsPort }} port: {{ .Values.volume.metricsPort }}
targetPort: {{ .Values.volume.metricsPort }} targetPort: {{ .Values.volume.metricsPort }}
protocol: TCP protocol: TCP

7
k8s/helm_charts2/templates/volume-servicemonitor.yaml

@ -11,10 +11,11 @@ metadata:
spec: spec:
endpoints: endpoints:
- interval: 30s - interval: 30s
port: swfs-volume-metrics
port: metrics
scrapeTimeout: 5s scrapeTimeout: 5s
selector: selector:
app: {{ template "seaweedfs.name" . }}
component: volume
matchLabels:
app: {{ template "seaweedfs.name" . }}
component: volume
{{- end }} {{- end }}
{{- end }} {{- end }}

8
k8s/helm_charts2/templates/volume-statefulset.yaml

@ -102,7 +102,7 @@ spec:
volume \ volume \
-port={{ .Values.volume.port }} \ -port={{ .Values.volume.port }} \
{{- if .Values.volume.metricsPort }} {{- if .Values.volume.metricsPort }}
-metricsPort {{ .Values.volume.metricsPort }} \
-metricsPort={{ .Values.volume.metricsPort }} \
{{- end }} {{- end }}
-dir={{ .Values.volume.dir }} \ -dir={{ .Values.volume.dir }} \
{{- if .Values.volume.dir_idx }} {{- if .Values.volume.dir_idx }}
@ -170,8 +170,12 @@ spec:
ports: ports:
- containerPort: {{ .Values.volume.port }} - containerPort: {{ .Values.volume.port }}
name: swfs-vol name: swfs-vol
{{- if .Values.volume.metricsPort }}
- containerPort: {{ .Values.filer.metricsPort }}
name: metrics
{{- end }}
- containerPort: {{ .Values.volume.grpcPort }} - containerPort: {{ .Values.volume.grpcPort }}
#name: swfs-vol-grpc
name: swfs-vol-grpc
readinessProbe: readinessProbe:
httpGet: httpGet:
path: /status path: /status

1
k8s/helm_charts2/values.yaml

@ -39,6 +39,7 @@ master:
replicas: 1 replicas: 1
port: 9333 port: 9333
grpcPort: 19333 grpcPort: 19333
metricsPort: 9327
ipBind: "0.0.0.0" ipBind: "0.0.0.0"
volumePreallocate: false volumePreallocate: false
volumeSizeLimitMB: 1000 volumeSizeLimitMB: 1000

14
other/metrics/grafana_seaweedfs_k8s.json

@ -1891,7 +1891,7 @@
"steppedLine": false, "steppedLine": false,
"targets": [ "targets": [
{ {
"expr": "go_memstats_alloc_bytes{namespace=~\"$namespace\", endpoint=\"swfs-filer-metrics\"}",
"expr": "go_memstats_alloc_bytes{namespace=~\"$namespace\", endpoint=\"metrics\"}",
"format": "time_series", "format": "time_series",
"hide": false, "hide": false,
"interval": "", "interval": "",
@ -1909,7 +1909,7 @@
"refId": "A" "refId": "A"
}, },
{ {
"expr": "go_memstats_stack_inuse_bytes{namespace=~\"$namespace\", endpoint=\"swfs-filer-metrics\"}",
"expr": "go_memstats_stack_inuse_bytes{namespace=~\"$namespace\", endpoint=\"metrics\"}",
"format": "time_series", "format": "time_series",
"hide": true, "hide": true,
"interval": "", "interval": "",
@ -1918,7 +1918,7 @@
"refId": "C" "refId": "C"
}, },
{ {
"expr": "go_memstats_heap_inuse_bytes{namespace=~\"$namespace\", endpoint=\"swfs-filer-metrics\"}",
"expr": "go_memstats_heap_inuse_bytes{namespace=~\"$namespace\", endpoint=\"metrics\"}",
"format": "time_series", "format": "time_series",
"hide": true, "hide": true,
"interval": "", "interval": "",
@ -2019,7 +2019,7 @@
"steppedLine": false, "steppedLine": false,
"targets": [ "targets": [
{ {
"expr": "go_gc_duration_seconds{namespace=~\"$namespace\", endpoint=\"swfs-filer-metrics\"}",
"expr": "go_gc_duration_seconds{namespace=~\"$namespace\", endpoint=\"metrics\"}",
"format": "time_series", "format": "time_series",
"interval": "", "interval": "",
"intervalFactor": 2, "intervalFactor": 2,
@ -2119,7 +2119,7 @@
"steppedLine": false, "steppedLine": false,
"targets": [ "targets": [
{ {
"expr": "go_goroutines{namespace=~\"$namespace\", endpoint=\"swfs-filer-metrics\"}",
"expr": "go_goroutines{namespace=~\"$namespace\", endpoint=\"metrics\"}",
"format": "time_series", "format": "time_series",
"interval": "", "interval": "",
"intervalFactor": 2, "intervalFactor": 2,
@ -2203,7 +2203,7 @@
"value": "s3" "value": "s3"
}, },
"datasource": "$DS_PROMETHEUS", "datasource": "$DS_PROMETHEUS",
"definition": "label_values({endpoint=\"swfs-filer-metrics\"}, namespace)",
"definition": "label_values({endpoint=\"metrics\"}, namespace)",
"hide": 0, "hide": 0,
"includeAll": false, "includeAll": false,
"label": "namespace", "label": "namespace",
@ -2216,7 +2216,7 @@
"value": "s3" "value": "s3"
} }
], ],
"query": "label_values({endpoint=\"swfs-filer-metrics\"}, namespace)",
"query": "label_values({endpoint=\"metrics\"}, namespace)",
"refresh": 0, "refresh": 0,
"regex": "", "regex": "",
"skipUrlSync": false, "skipUrlSync": false,

Loading…
Cancel
Save