service mesh istio微服务实验之监控日志与可视化

栏目: 服务器 · 发布时间: 7年前

内容简介:jaeger的dashboard界面调用链服务树展示
# 下载yml文件
mkdir jaeger && cd jaeger
wget https://raw.githubusercontent.com/jaegertracing/jaeger-kubernetes/master/all-in-one/jaeger-all-in-one-template.yml

# 实验环境不支持 LoadBalancer
# 可以修改jaeger-all-in-one-template.yml使用nodeport
# 也可以不修改,这样的会使用随机的nodeport

# 启动
kubectl apply -n istio-system -f jaeger-all-in-one-template.yml

# 查看
kubectl get pods -n istio-system
kubectl get svc -n istio-system

# 多次访问之前的vue react界面并点击发射按钮

# 访问
jaegerNodePort=$(kubectl get svc -n istio-system | grep jaeger-query | awk '{print $5}' | cut -d '/' -f 1 | cut -d ':' -f 2)
nodeName=$(kubectl get no | grep '<none>' | head -1 | awk '{print $1}')
nodeIP=$(ping -c 1 $nodeName | grep PING | awk '{print $3}' | tr -d '()')
echo "http://$nodeIP:"$jaegerNodePort

# 选择 istio-ingress 可以方便查看整个调用链

# 清理
cd jaeger
kubectl delete -n istio-system -f jaeger-all-in-one-template.yml
复制代码

jaeger的dashboard界面

service mesh istio微服务实验之监控日志与可视化

调用链

service mesh istio微服务实验之监控日志与可视化

服务树展示

service mesh istio微服务实验之监控日志与可视化

日志与指标收集

安装

# 安装prometheus
cd /usr/local/istio

# 修改支持nodeport
cp install/kubernetes/addons/prometheus.yaml install/kubernetes/addons/prometheus.yaml.ori
vim install/kubernetes/addons/prometheus.yaml
...
apiVersion: v1
kind: Service
metadata:
  annotations:
    prometheus.io/scrape: 'true'
  labels:
    name: prometheus
  name: prometheus
  namespace: istio-system
spec:
  selector:
    app: prometheus
  ports:
  - name: prometheus
    protocol: TCP
    port: 9090
  # 设置使用 nodeport
  type: NodePort
...

# 部署
kubectl apply -f install/kubernetes/addons/prometheus.yaml

# 配置收集
istioctl create -f istio/new_telemetry.yml

# 多次访问之前的vue react界面并点击发射按钮

# 访问web测试
prometheusNodePort=$(kubectl get svc -n istio-system | grep prometheus | awk '{print $5}' | cut -d '/' -f 1 | cut -d ':' -f 2)
nodeName=$(kubectl get no | grep '<none>' | head -1 | awk '{print $1}')
nodeIP=$(ping -c 1 $nodeName | grep PING | awk '{print $3}' | tr -d '()')
echo "http://$nodeIP:"$prometheusNodePort

# 使用 istio_double_request_count  关键字查询

# 查看日志
kubectl -n istio-system logs $(kubectl -n istio-system get pods -l istio=mixer -o jsonpath='{.items[0].metadata.name}') mixer | grep \"instance\":\"newlog.logentry.istio-system\"

# 清理
kubectl delete -f install/kubernetes/addons/prometheus.yaml
istioctl delete -f istio/new_telemetry.yml
复制代码

收集TCP服务的指标

安装

# 安装prometheus
cd /usr/local/istio

# 修改支持nodeport
cp install/kubernetes/addons/prometheus.yaml install/kubernetes/addons/prometheus.yaml.ori
vim install/kubernetes/addons/prometheus.yaml
...
apiVersion: v1
kind: Service
metadata:
  annotations:
    prometheus.io/scrape: 'true'
  labels:
    name: prometheus
  name: prometheus
  namespace: istio-system
spec:
  selector:
    app: prometheus
  ports:
  - name: prometheus
    protocol: TCP
    port: 9090
  # 设置使用 nodeport
  type: NodePort
...

# 部署
kubectl apply -f install/kubernetes/addons/prometheus.yaml

# 配置收集
istioctl create -f istio/tcp_telemetry.yml

# 部署使用 mongodb 应用测试

# 访问web测试
prometheusNodePort=$(kubectl get svc -n istio-system | grep prometheus | awk '{print $5}' | cut -d '/' -f 1 | cut -d ':' -f 2)
nodeName=$(kubectl get no | grep '<none>' | head -1 | awk '{print $1}')
nodeIP=$(ping -c 1 $nodeName | grep PING | awk '{print $3}' | tr -d '()')
echo "http://$nodeIP:"$prometheusNodePort

# 使用 istio_mongo_received_bytes  关键字查询

# 清理
kubectl delete -f install/kubernetes/addons/prometheus.yaml
istioctl delete -f istio/tcp_telemetry.yml
复制代码

TCP数据流图

service mesh istio微服务实验之监控日志与可视化

使用grafana可视化指标

安装

# 安装prometheus
cd /usr/local/istio

# 修改支持nodeport
cp install/kubernetes/addons/prometheus.yaml install/kubernetes/addons/prometheus.yaml.ori
vim install/kubernetes/addons/prometheus.yaml
...
apiVersion: v1
kind: Service
metadata:
  annotations:
    prometheus.io/scrape: 'true'
  labels:
    name: prometheus
  name: prometheus
  namespace: istio-system
spec:
  selector:
    app: prometheus
  ports:
  - name: prometheus
    protocol: TCP
    port: 9090
  # 设置使用 nodeport
  type: NodePort
...
cp install/kubernetes/addons/grafana.yaml install/kubernetes/addons/grafana.yaml.ori
vim install/kubernetes/addons/grafana.yaml
kind: Service
metadata:
  name: grafana
  namespace: istio-system
spec:
  # 设置使用 nodeport
  type: NodePort
  ports:
  - port: 3000
    protocol: TCP
    name: http
  selector:
    app: grafana

# 部署
kubectl apply -f install/kubernetes/addons/prometheus.yaml
kubectl apply -f install/kubernetes/addons/grafana.yaml

# 访问web测试
grafanaNodePort=$(kubectl get svc -n istio-system | grep grafana | awk '{print $5}' | cut -d '/' -f 1 | cut -d ':' -f 2)
nodeName=$(kubectl get no | grep '<none>' | head -1 | awk '{print $1}')
nodeIP=$(ping -c 1 $nodeName | grep PING | awk '{print $3}' | tr -d '()')
echo "http://$nodeIP:"$grafanaNodePort

# 压力测试查看图表
# 创建测试用的fortio
kubectl apply -f <(istioctl kube-inject -f istio/fortio-deploy.yaml)

# 正常访问测试
FORTIO_POD=$(kubectl get pod | grep fortio | awk '{ print $1 }')
kubectl exec -it $FORTIO_POD  -c fortio /usr/local/bin/fortio -- load -curl http://service-python/env

# 加大压力测试
kubectl exec -it $FORTIO_POD  -c fortio /usr/local/bin/fortio -- load -qps 20 -t 100s -loglevel Warning http://service-python/env
kubectl exec -it $FORTIO_POD  -c fortio /usr/local/bin/fortio -- load -qps 50 -t 100s -loglevel Warning http://service-go/env

# 清理
kubectl delete -f install/kubernetes/addons/prometheus.yaml
kubectl delete -f install/kubernetes/addons/grafana.yaml
kubectl delete -f istio/fortio-deploy.yaml
复制代码

service mesh 数据监控展示

service mesh istio微服务实验之监控日志与可视化

pilot数据监控展示

service mesh istio微服务实验之监控日志与可视化

生成服务树

安装

# 修改使用nodeport
cd /usr/local/istio
cp install/kubernetes/addons/servicegraph.yaml install/kubernetes/addons/servicegraph.yaml.ori
vim install/kubernetes/addons/servicegraph.yaml
...
apiVersion: v1
kind: Service
metadata:
  name: servicegraph
  namespace: istio-system
spec:
  # 设置使用 nodeport
  type: NodePort
  ports:
  - name: http
    port: 8088
  selector:
    app: servicegraph
...

# 安装prometheus
cd /usr/local/istio

# 修改支持nodeport
cp install/kubernetes/addons/prometheus.yaml install/kubernetes/addons/prometheus.yaml.ori
vim install/kubernetes/addons/prometheus.yaml
...
apiVersion: v1
kind: Service
metadata:
  annotations:
    prometheus.io/scrape: 'true'
  labels:
    name: prometheus
  name: prometheus
  namespace: istio-system
spec:
  selector:
    app: prometheus
  ports:
  - name: prometheus
    protocol: TCP
    port: 9090
  # 设置使用 nodeport
  type: NodePort
...

# 部署
kubectl apply -f install/kubernetes/addons/prometheus.yaml
kubectl apply -f install/kubernetes/addons/servicegraph.yaml

# 多次访问之前的vue react界面并点击发射按钮

# 访问web测试
servicegraphNodePort=$(kubectl get svc -n istio-system | grep servicegraph | awk '{print $5}' | cut -d '/' -f 1 | cut -d ':' -f 2)
nodeName=$(kubectl get no | grep '<none>' | head -1 | awk '{print $1}')
nodeIP=$(ping -c 1 $nodeName | grep PING | awk '{print $3}' | tr -d '()')
echo "http://$nodeIP:"$servicegraphNodePort/force/forcegraph.html

# 可使用url
# /force/forcegraph.html
# /dotviz
# /dotgraph
# /d3graph
# /graph

# 清理
kubectl delete -f install/kubernetes/addons/prometheus.yaml
kubectl delete -f install/kubernetes/addons/servicegraph.yaml
复制代码

服务树

service mesh istio微服务实验之监控日志与可视化

使用Fluentd收集日志

安装

# 安装efk
kubectl apply -f istio/logging-stack.yml

# 配置istio使用efk
istioctl create -f istio/fluentd-istio.yml

# 多次访问之前的vue react界面并点击发射按钮

# 访问web测试
kibanaNodePort=$(kubectl get svc -n istio-system | grep kibana | awk '{print $5}' | cut -d '/' -f 1 | cut -d ':' -f 2)
nodeName=$(kubectl get no | grep '<none>' | head -1 | awk '{print $1}')
nodeIP=$(ping -c 1 $nodeName | grep PING | awk '{print $3}' | tr -d '()')
echo "http://$nodeIP:"$kibanaNodePort

# 清理
kubectl delete -f istio/logging-stack.yml
istio delete -f istio/fluentd-istio.yml
复制代码

以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

The Seasoned Schemer

The Seasoned Schemer

Daniel P. Friedman、Matthias Felleisen / The MIT Press / 1995-12-21 / USD 38.00

drawings by Duane Bibbyforeword and afterword by Guy L. Steele Jr.The notion that "thinking about computing is one of the most exciting things the human mind can do" sets both The Little Schemer (form......一起来看看 《The Seasoned Schemer》 这本书的介绍吧!

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具