From 23b5db83dfc5323802fe3ebdbcda7ae141517b02 Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 19 Oct 2018 19:24:42 -0500 Subject: [PATCH] updated to work with Istio 1.0 metrics (#13) * updated to work with Istio 1.0 metrics * removed duplicate --- README.md | 4 + helm/vistio/values-mesh-only.yaml | 6 +- helm/vistio/values-with-ingress.yaml | 6 +- vistio-mesh-only-1.0.yaml | 216 ++++++++++++++++++++++++++ vistio-with-ingress-1.0.yaml | 217 +++++++++++++++++++++++++++ 5 files changed, 443 insertions(+), 6 deletions(-) create mode 100644 vistio-mesh-only-1.0.yaml create mode 100644 vistio-with-ingress-1.0.yaml diff --git a/README.md b/README.md index 7162e48..8673946 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,9 @@ It has 2 components: - Vistio-Web: Forked from [Promviz-front](https://github.com/mjhd-devlion/promviz-front): based on Netflix's [vizceral](https://github.com/Netflix/vizceral) to render traffic graph. +## Updated for Istio 1.0 +The helm charts have been updated to work with Istio 1.0 + ## Features: - Generates and renders traffic graph in realtime - Able to replay from any time in the past @@ -34,6 +37,7 @@ It has 2 components: - Provides a sidecar application for k8s that watches config changes and reload Vistio server in runtime - Fits with [Istio](https://istio.io)'s metrics + ![](https://github.com/nmnellis/vistio/blob/master/documentation/sample.png) ## Architecture diff --git a/helm/vistio/values-mesh-only.yaml b/helm/vistio/values-mesh-only.yaml index c5d2f1b..1febc65 100644 --- a/helm/vistio/values-mesh-only.yaml +++ b/helm/vistio/values-mesh-only.yaml @@ -11,7 +11,7 @@ vistioConfig: maxVolume: 100 clusterConnections: # Total requests per second of the mesh - - query: sum(rate(istio_request_count[1m])) by (response_code) + - query: sum(rate(istio_requests_total[1m])) by (response_code) prometheusURL: http://prometheus.istio-system:9090 source: replacement: "Total Mesh Requests" @@ -27,10 +27,10 @@ vistioConfig: - cluster: istio-mesh maxVolume: 100 serviceConnections: - - query: sum(rate(istio_request_count[1m])) by (source_service,destination_service,response_code) + - query: sum(rate(istio_requests_total[1m])) by (source_app,destination_service,response_code) prometheusURL: http://prometheus.istio-system:9090 source: - label: source_service + label: source_app target: label: destination_service status: diff --git a/helm/vistio/values-with-ingress.yaml b/helm/vistio/values-with-ingress.yaml index cad1d74..37bed89 100644 --- a/helm/vistio/values-with-ingress.yaml +++ b/helm/vistio/values-with-ingress.yaml @@ -9,7 +9,7 @@ vistioConfig: maxVolume: 2000000 clusterConnections: # Total requests per second coming into the ingress controller from internet - - query: sum(rate(istio_request_count{destination_service="istio-ingressgateway.istio-system.svc.cluster.local"}[1m])) by (response_code) + - query: sum(rate(istio_requests_total{reporter="source", source_workload="istio-ingressgateway"}[1m])) by (response_code) prometheusURL: http://prometheus.istio-system:9090 source: replacement: INTERNET @@ -25,10 +25,10 @@ vistioConfig: - cluster: istio-mesh maxVolume: 3000 serviceConnections: - - query: sum(rate(istio_request_count[1m])) by (source_service,destination_service,response_code) + - query: sum(rate(istio_requests_total[1m])) by (source_app,destination_service,response_code) prometheusURL: http://prometheus.istio-system:9090 source: - label: source_service + label: source_app target: label: destination_service status: diff --git a/vistio-mesh-only-1.0.yaml b/vistio-mesh-only-1.0.yaml new file mode 100644 index 0000000..38f94e9 --- /dev/null +++ b/vistio-mesh-only-1.0.yaml @@ -0,0 +1,216 @@ +--- +# Source: vistio/templates/configmap.yaml +apiVersion: v1 +kind: ConfigMap +metadata: + name: vistio-api-config + labels: + heritage: Tiller + chart: "vistio-0.1.0" + app: vistio + release: vistio +data: + vistio.yaml: |- + clusterLevel: + - cluster: istio-mesh + maxVolume: 100 + serviceConnections: + - notices: + - name: HighErrorRate + severityThreshold: + error: 0.05 + warning: 0.01 + statusType: danger + title: '[{{ .value }}] High Error Rate' + prometheusURL: http://prometheus.istio-system:9090 + query: sum(rate(istio_requests_total[1m])) by (source_app,destination_service,response_code) + source: + label: source_app + status: + dangerRegex: ^5..$ + label: response_code + warningRegex: ^4..$ + target: + label: destination_service + globalLevel: + clusterConnections: + - prometheusURL: http://prometheus.istio-system:9090 + query: sum(rate(istio_requests_total[1m])) by (response_code) + source: + replacement: Total Mesh Requests + status: + dangerRegex: ^5..$ + label: response_code + warningRegex: ^4..$ + target: + replacement: istio-mesh + maxVolume: 100 + graphName: Vistio + +--- +# Source: vistio/templates/service.yaml +apiVersion: v1 +kind: Service +metadata: + name: vistio-api + labels: + heritage: Tiller + chart: "vistio-0.1.0" + app: vistio-api + release: vistio +spec: + type: ClusterIP + selector: + app: vistio-api + release: vistio + ports: + - name: http + port: 9091 + targetPort: 9091 + protocol: TCP +--- +apiVersion: v1 +kind: Service +metadata: + name: vistio-web + labels: + heritage: Tiller + chart: "vistio-0.1.0" + app: vistio-web + release: vistio +spec: + type: ClusterIP + selector: + app: vistio-web + release: vistio + ports: + - name: http + port: 8080 + targetPort: 8080 + protocol: TCP + +--- +# Source: vistio/templates/deployment.yaml +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: vistio-web + labels: + heritage: Tiller + chart: "vistio-0.1.0" + app: vistio-web + release: vistio +spec: + replicas: 1 + template: + metadata: + labels: + app: vistio-web + release: vistio + spec: + containers: + - name: vistio + image: "nmnellis/vistio-web:v0.1.0" + imagePullPolicy: Always + ports: + - containerPort: 8080 + env: + - name: UPDATE_URL + value: http://localhost:9091/graph + - name: INTERVAL + value: "1000" + - name: MAX_REPLAY_OFFSET + value: "43200" + resources: + {} + + +--- +# Source: vistio/templates/statefulset.yaml +apiVersion: apps/v1beta1 +kind: StatefulSet +metadata: + name: vistio-api + labels: + heritage: Tiller + chart: "vistio-0.1.0" + app: vistio-api + release: vistio +spec: + replicas: 1 + serviceName: vistio + template: + metadata: + labels: + app: vistio-api + release: vistio + spec: + containers: + - name: vistio-api + image: nmnellis/vistio-api:v0.1.0 + imagePullPolicy: IfNotPresent + args: + - --config.file=/etc/vistio/vistio.yaml + - --log.level=info + - --storage.path=/var/vistio/data + - --storage.retention=24h + - --cache.size=100 + - --retrieval.scrape-interval=10s + - --retrieval.scrape-timeout=8s + - --api.port=9091 + ports: + - containerPort: 9091 + livenessProbe: + httpGet: + path: / + port: 9091 + initialDelaySeconds: 30 + timeoutSeconds: 30 + readinessProbe: + httpGet: + path: / + port: 9091 + initialDelaySeconds: 30 + timeoutSeconds: 30 + resources: + {} + + volumeMounts: + - name: config + mountPath: /etc/vistio + - name: vistio-db + mountPath: /var/vistio/data + subPath: vistio-db + - name: reloader + image: nghialv2607/k8s-config-reloader:v0.1.0 + imagePullPolicy: IfNotPresent + args: + - --config.promviz-reload-url=http://localhost:9091/reload + - --config.promviz-config-dir=/etc/vistio + - --config.log-level=info + resources: + limits: + cpu: 50m + memory: 64Mi + requests: + cpu: 20m + memory: 32Mi + + volumeMounts: + - name: config + mountPath: /etc/vistio + volumes: + - name: config + configMap: + name: vistio-api-config + volumeClaimTemplates: + - metadata: + annotations: + volume.beta.kubernetes.io/storage-class: standard + name: vistio-db + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 5Gi diff --git a/vistio-with-ingress-1.0.yaml b/vistio-with-ingress-1.0.yaml new file mode 100644 index 0000000..4aee6be --- /dev/null +++ b/vistio-with-ingress-1.0.yaml @@ -0,0 +1,217 @@ +--- +# Source: vistio/templates/configmap.yaml +apiVersion: v1 +kind: ConfigMap +metadata: + name: vistio-api-config + labels: + heritage: Tiller + chart: "vistio-0.1.0" + app: vistio + release: vistio +data: + vistio.yaml: |- + clusterLevel: + - cluster: istio-mesh + maxVolume: 3000 + serviceConnections: + - notices: + - name: HighErrorRate + severityThreshold: + error: 0.05 + warning: 0.01 + statusType: danger + title: '[{{ .value }}] High Error Rate' + prometheusURL: http://prometheus.istio-system:9090 + query: sum(rate(istio_requests_total[1m])) by (source_app,destination_service,response_code) + source: + label: source_app + status: + dangerRegex: ^5..$ + label: response_code + warningRegex: ^4..$ + target: + label: destination_service + globalLevel: + clusterConnections: + - prometheusURL: http://prometheus.istio-system:9090 + query: sum(rate(istio_requests_total{reporter="source", source_workload="istio-ingressgateway"}[1m])) + by (response_code) + source: + replacement: INTERNET + status: + dangerRegex: ^5..$ + label: response_code + warningRegex: ^4..$ + target: + replacement: istio-mesh + maxVolume: 2000000 + graphName: Vistio + +--- +# Source: vistio/templates/service.yaml +apiVersion: v1 +kind: Service +metadata: + name: vistio-api + labels: + heritage: Tiller + chart: "vistio-0.1.0" + app: vistio-api + release: vistio +spec: + type: ClusterIP + selector: + app: vistio-api + release: vistio + ports: + - name: http + port: 9091 + targetPort: 9091 + protocol: TCP +--- +apiVersion: v1 +kind: Service +metadata: + name: vistio-web + labels: + heritage: Tiller + chart: "vistio-0.1.0" + app: vistio-web + release: vistio +spec: + type: ClusterIP + selector: + app: vistio-web + release: vistio + ports: + - name: http + port: 8080 + targetPort: 8080 + protocol: TCP + +--- +# Source: vistio/templates/deployment.yaml +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: vistio-web + labels: + heritage: Tiller + chart: "vistio-0.1.0" + app: vistio-web + release: vistio +spec: + replicas: 1 + template: + metadata: + labels: + app: vistio-web + release: vistio + spec: + containers: + - name: vistio + image: "nmnellis/vistio-web:v0.1.0" + imagePullPolicy: Always + ports: + - containerPort: 8080 + env: + - name: UPDATE_URL + value: http://localhost:9091/graph + - name: INTERVAL + value: "1000" + - name: MAX_REPLAY_OFFSET + value: "43200" + resources: + {} + + +--- +# Source: vistio/templates/statefulset.yaml +apiVersion: apps/v1beta1 +kind: StatefulSet +metadata: + name: vistio-api + labels: + heritage: Tiller + chart: "vistio-0.1.0" + app: vistio-api + release: vistio +spec: + replicas: 1 + serviceName: vistio + template: + metadata: + labels: + app: vistio-api + release: vistio + spec: + containers: + - name: vistio-api + image: nmnellis/vistio-api:v0.1.0 + imagePullPolicy: IfNotPresent + args: + - --config.file=/etc/vistio/vistio.yaml + - --log.level=info + - --storage.path=/var/vistio/data + - --storage.retention=24h + - --cache.size=100 + - --retrieval.scrape-interval=10s + - --retrieval.scrape-timeout=8s + - --api.port=9091 + ports: + - containerPort: 9091 + livenessProbe: + httpGet: + path: / + port: 9091 + initialDelaySeconds: 30 + timeoutSeconds: 30 + readinessProbe: + httpGet: + path: / + port: 9091 + initialDelaySeconds: 30 + timeoutSeconds: 30 + resources: + {} + + volumeMounts: + - name: config + mountPath: /etc/vistio + - name: vistio-db + mountPath: /var/vistio/data + subPath: vistio-db + - name: reloader + image: nghialv2607/k8s-config-reloader:v0.1.0 + imagePullPolicy: IfNotPresent + args: + - --config.promviz-reload-url=http://localhost:9091/reload + - --config.promviz-config-dir=/etc/vistio + - --config.log-level=info + resources: + limits: + cpu: 50m + memory: 64Mi + requests: + cpu: 20m + memory: 32Mi + + volumeMounts: + - name: config + mountPath: /etc/vistio + volumes: + - name: config + configMap: + name: vistio-api-config + volumeClaimTemplates: + - metadata: + annotations: + volume.beta.kubernetes.io/storage-class: standard + name: vistio-db + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 5Gi