feat: integrating metrics support for Istio with KubeZero metrics

This commit is contained in:
Stefan Reimer 2021-04-22 15:43:10 +02:00
parent 6b2e248f5d
commit 2dc64d7b1b
9 changed files with 77 additions and 2 deletions

View File

@ -2,7 +2,7 @@ apiVersion: v2
name: kubezero-istio-ingress
description: KubeZero Umbrella Chart for Istio based Ingress
type: application
version: 0.5.4
version: 0.5.5
appVersion: 1.9.3
home: https://kubezero.com
icon: https://cdn.zero-downtime.net/assets/kubezero/logo-small-64.png

View File

@ -0,0 +1,36 @@
{{- if or ( index .Values "istio-ingress" "telemetry" "enabled" ) ( index .Values "istio-private-ingress" "telemetry" "enabled" )}}
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: envoy-stats-monitor
namespace: istio-ingress
labels:
release: metrics
spec:
selector:
matchExpressions:
- {key: istio-prometheus-ignore, operator: DoesNotExist}
jobLabel: envoy-stats
podMetricsEndpoints:
- path: /stats/prometheus
interval: 30s
relabelings:
- action: keep
sourceLabels: [__meta_kubernetes_pod_container_name]
regex: "istio-proxy"
- action: keep
sourceLabels: [__meta_kubernetes_pod_annotationpresent_prometheus_io_scrape]
- sourceLabels: [__address__, __meta_kubernetes_pod_annotation_prometheus_io_port]
action: replace
regex: ([^:]+)(?::\d+)?;(\d+)
replacement: $1:$2
targetLabel: __address__
- action: labeldrop
regex: "__meta_kubernetes_pod_label_(.+)"
- sourceLabels: [__meta_kubernetes_namespace]
action: replace
targetLabel: namespace
- sourceLabels: [__meta_kubernetes_pod_name]
action: replace
targetLabel: pod_name
{{- end }}

View File

@ -17,6 +17,9 @@ global:
istio-ingress:
enabled: false
telemetry:
enabled: false
gateways:
istio-ingressgateway:
autoscaleEnabled: false
@ -90,6 +93,9 @@ istio-ingress:
istio-private-ingress:
enabled: false
telemetry:
enabled: false
gateways:
istio-ingressgateway:
# name and labels make the ingress private

View File

@ -2,7 +2,7 @@ apiVersion: v2
name: kubezero-istio
description: KubeZero Umbrella Chart for Istio
type: application
version: 0.5.4
version: 0.5.5
appVersion: 1.9.3
home: https://kubezero.com
icon: https://cdn.zero-downtime.net/assets/kubezero/logo-small-64.png

View File

@ -22,3 +22,9 @@ Installs the Istio control plane
- https://istio.io/latest/docs/reference/config/istio.operator.v1alpha1/#IstioOperatorSpec
- https://github.com/istio/istio/blob/master/manifests/profiles/default.yaml
- https://istio.io/latest/docs/setup/install/standalone-operator/
### Grafana
- https://grafana.com/grafana/dashboards/7645
- https://grafana.com/grafana/dashboards/7639
- https://grafana.com/grafana/dashboards/7636
- https://grafana.com/grafana/dashboards/7630

View File

@ -0,0 +1,18 @@
{{- if index .Values "istio-discovery" "telemetry" "enabled" }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: istio-component-monitor
namespace: istio-system
labels:
release: metrics
spec:
jobLabel: istio
targetLabels: [app]
selector:
matchExpressions:
- {key: istio, operator: In, values: [pilot]}
endpoints:
- port: http-monitoring
interval: 30s
{{- end }}

View File

@ -65,6 +65,8 @@ kube-prometheus-stack:
releaseNamespace: true
additional:
- kube-system
- istio-system
- istio-ingress
- logging
admissionWebhooks:

View File

@ -8,6 +8,8 @@ global:
{{- if index .Values "istio-ingress" "public" }}
istio-ingress:
enabled: {{ index .Values "istio-ingress" "public" "enabled" }}
telemetry:
enabled: {{ .Values.metrics.enabled }}
{{- with index .Values "istio-ingress" "public" "gateway" }}
gateways:
istio-ingressgateway:
@ -22,6 +24,8 @@ istio-ingress:
{{- if index .Values "istio-ingress" "private" }}
istio-private-ingress:
enabled: {{ index .Values "istio-ingress" "private" "enabled" }}
telemetry:
enabled: {{ .Values.metrics.enabled }}
{{- with index .Values "istio-ingress" "private" "gateway" }}
gateways:
istio-ingressgateway:

View File

@ -8,6 +8,9 @@ global:
istio-discovery:
pilot:
replicaCount: 2
telemetry:
enabled: {{ .Values.metrics.enabled }}
{{- end }}
{{- end }}