Istio可视化监控(网格可视化、调用链)

一、前言

今天着重总结下istio微服务调用链关系展示,以及微服务工作状态监测,涉及组件有:prometheus  grafana  jaeger  Kiali 等。

  • 监控指标(Grafana)
  • 网格可视化(Kiali)
  • 调用链跟踪(Jaeger)

昨天我写了篇文章,关于通过gateway暴露内部微服务的示例,本章由于istio的如上内部组件全部都是内部访问,所以我们需要通过istio的gateway服务全部暴露出来:

[root@k8s-master1 ~]# kubectl get svc -n istio-system
NAME                     TYPE           CLUSTER-IP   EXTERNAL-IP   PORT(S)                         AGE
grafana                  ClusterIP      10.0.0.42    <none>        3000/TCP
kiali                    ClusterIP      10.0.0.171   <none>        20001/TCP                         41h
prometheus               ClusterIP      10.0.0.33    <none>        9090/TCP
jaeger-agent             ClusterIP      None         <none>        5775/UDP,6831/UDP,6832/UDP                         41h
jaeger-collector         ClusterIP      10.0.0.251   <none>        14267/TCP,14268/TCP,14250/TCP                         41h
jaeger-query             ClusterIP      10.0.0.200   <none>        16686/TCP
tracing                  ClusterIP      10.0.0.71    <none>        80/TCP

1.1、内部监控组件服务暴露

# cat monitor-gateway.yaml
---
# 监控指标
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: grafana-gateway
spec:
  selector:
    istio: ingressgateway
  servers:
  - port:
      number: 80
      name: http
      protocol: HTTP
    hosts:
    - "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: grafana
spec:
  hosts:
  - "grafana.zhdya.cn"
  gateways:
  - grafana-gateway
  http:
  - route:
    - destination:
        host: grafana
        port:
          number: 3000

---
# 网格可视化 Kiali
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: kiali-gateway
spec:
  selector:
    istio: ingressgateway
  servers:
  - port:
      number: 80
      name: http
      protocol: HTTP
    hosts:
    - "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: kiali
spec:
  hosts:
  - "kiali.zhdya.cn"
  gateways:
  - kiali-gateway
  http:
  - route:
    - destination:
        host: kiali
        port:
          number: 20001
---
# 调用链
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: tracing-gateway
spec:
  selector:
    istio: ingressgateway
  servers:
  - port:
      number: 80
      name: http
      protocol: HTTP
    hosts:
    - "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: tracing
spec:
  hosts:
  - "tracing.zhdya.cn"
  gateways:
  - tracing-gateway
  http:
  - route:
    - destination:
        host: tracing
        port:
          number: 80

应用并绑定hosts即可访问:

# kubectl apply -f monitor-gateway.yaml -n istio-system

# kubectl get gateway -n istio-system

二、各个组件的dashboard

绑定刚刚配置nginx虚机的IP,再次访问:

当然最好搞个for循环,产生一些数据看的更直观些!

# for i in {1..1000}; do curl -I http://192.168.171.10/productpage -H "Host: bookinfo.zhdya.cn";sleep 1; done
#### 2.1、grafana: mark

2.2、kiali

mark

2.3、tracing

mark

更详细的一些数据成图就不一一讲解了,每个组件都能直直观的观察到每个应用的调用链流量及性能其它指标,查看下相关的资料即可;

三、总结:

grafana: - 请求错误率; - 请求时延;

kiali: - 链路调用拓扑图; - RPS(每秒请求),及错误率; - 请求/响应数据包大小; - 查看Pod日志; - Istio资源热编辑更新;

Jager: - 各个服务间的调用链; - 数据包中的具体请求/响应信息; - 各个RPS的响应时间;


本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!