首页 > 其他分享 >istio部署demoapp应用 (八)故障注入

istio部署demoapp应用 (八)故障注入

时间:2022-10-26 17:23:22浏览次数:58  
标签:Proxying ServerName istio value Took demoapp 故障注入 milliseconds

故障注入

  • 故障注入有两种典型的场景

    • delay:注入“延迟”

    • abort:注入“中断”

virtualservice-demoapp.yaml

apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
  name: demoapp
spec:
  hosts:
  - demoapp
  http:
  - name: canary
    match:
    - uri:
        prefix: /canary
    rewrite:
      uri: /
    route:
    - destination:
        host: demoapp
        subset: v11
    fault:
      abort:
        percentage:
          value: 20
        httpStatus: 555
  - name: default
    route:
    - destination:
        host: demoapp
        subset: v10
    fault:
      delay:
        percentage:
          value: 20
        fixedDelay: 3s

更新demoapp vs

# kubectl apply -f virtualservice-demoapp.yaml 
virtualservice.networking.istio.io/demoapp configured

访问demoapp

测试延迟

 - Took 3078 milliseconds.

~# while true;do curl app.wgs.com;done
Proxying value: iKubernetes demoapp v1.0 !! ClientIP: 127.0.0.6, ServerName: demoappv10-78b6586d58-hq957, ServerIP: 172.20.44.206!
 - Took 3088 milliseconds.
Proxying value: iKubernetes demoapp v1.0 !! ClientIP: 127.0.0.6, ServerName: demoappv10-78b6586d58-kdv4m, ServerIP: 172.20.154.195!
 - Took 15 milliseconds.
Proxying value: iKubernetes demoapp v1.0 !! ClientIP: 127.0.0.6, ServerName: demoappv10-78b6586d58-kdv4m, ServerIP: 172.20.154.195!
 - Took 5 milliseconds.
Proxying value: iKubernetes demoapp v1.0 !! ClientIP: 127.0.0.6, ServerName: demoappv10-78b6586d58-hq957, ServerIP: 172.20.44.206!
 - Took 7 milliseconds.
Proxying value: iKubernetes demoapp v1.0 !! ClientIP: 127.0.0.6, ServerName: demoappv10-78b6586d58-kdv4m, ServerIP: 172.20.154.195!
 - Took 5 milliseconds.
Proxying value: iKubernetes demoapp v1.0 !! ClientIP: 127.0.0.6, ServerName: demoappv10-78b6586d58-kdv4m, ServerIP: 172.20.154.195!
 - Took 70 milliseconds.
Proxying value: iKubernetes demoapp v1.0 !! ClientIP: 127.0.0.6, ServerName: demoappv10-78b6586d58-hq957, ServerIP: 172.20.44.206!
 - Took 5 milliseconds.
Proxying value: iKubernetes demoapp v1.0 !! ClientIP: 127.0.0.6, ServerName: demoappv10-78b6586d58-kdv4m, ServerIP: 172.20.154.195!
 - Took 3078 milliseconds.
Proxying value: iKubernetes demoapp v1.0 !! ClientIP: 127.0.0.6, ServerName: demoappv10-78b6586d58-hq957, ServerIP: 172.20.44.206!
 - Took 5 milliseconds.

测试中断

Proxying value: fault filter abort - Took 15 milliseconds.

~# while true;do curl app.wgs.com/canary;done
Proxying value: iKubernetes demoapp v1.1 !! ClientIP: 127.0.0.6, ServerName: demoappv11-78bf898c74-hckjf, ServerIP: 172.20.89.189!
 - Took 8 milliseconds.
Proxying value: iKubernetes demoapp v1.1 !! ClientIP: 127.0.0.6, ServerName: demoappv11-78bf898c74-sn9qp, ServerIP: 172.20.154.253!
 - Took 10 milliseconds.
Proxying value: iKubernetes demoapp v1.1 !! ClientIP: 127.0.0.6, ServerName: demoappv11-78bf898c74-sn9qp, ServerIP: 172.20.154.253!
 - Took 12 milliseconds.
Proxying value: iKubernetes demoapp v1.1 !! ClientIP: 127.0.0.6, ServerName: demoappv11-78bf898c74-sn9qp, ServerIP: 172.20.154.253!
 - Took 5 milliseconds.
Proxying value: fault filter abort - Took 15 milliseconds.
Proxying value: fault filter abort - Took 7 milliseconds.

访问kiali

参考文档

https://istio.io/latest/zh/docs/reference/config/networking/virtual-service/#HTTPFaultInjection

标签:Proxying,ServerName,istio,value,Took,demoapp,故障注入,milliseconds
From: https://www.cnblogs.com/wangguishe/p/16829189.html

相关文章

  • Istio ServiceEntry
    ServiceEntry介绍ServiceEntry用于将未能自动添加至网格中的服务,以手动形式添加至网格中,以使得网格内的自动发现机制能够访问或路由到这些服务未能自动添加至网格中的......
  • Istio gateway
    Gateway配置要点Gateway定义运行在网格边缘的负载均衡器,负责接收入站或出站的HTTP/TCP连接主要定义应该暴露到网格外部的端口、要使用的协议类型、以及SNI配置等......
  • Istio DestinationRule
    DestinationRule配置要点DestinationRule用于配置路由完成之后的应用于服务的流量策略,即配置如何将流量调度至上游端点,同时也是为VirtualService的Destination指定的目标......
  • istio部署demoapp应用 (六)基于权重的流量分割
    架构图virtualservice-demoapp.yamlapiVersion:networking.istio.io/v1beta1kind:VirtualServicemetadata:name:demoappspec:hosts:-demoapphttp:......
  • istio部署demoapp应用 (四) Ingress-gateway暴露demoapp
    proxy-gateway.yamlapiVersion:networking.istio.io/v1beta1kind:Gatewaymetadata:name:proxy-gatewaynamespace:istio-systemspec:selector:app:i......
  • istio部署demoapp多版本应用示例
    环境说明frontend(proxy):前端应用,会请求后端的demoappservice:proxydemoapp:后端应用同时部署两个版本 部署demoappv1.0deploy-demoapp-v10.yamla......
  • istio部署后端单版本应用示例
    环境说明frontend(proxy):前端应用,会请求后端的demoappservice:proxydemoapp:后端应用service:demoappv10访问流程clientpod--->(EgressListener......
  • Istio流量治理基础
    流量治理Istio的流量路由规则使运维人员可以轻松控制服务之间的流量和API调用Istio简化了诸如断路器,超时和重试之类的服务级别属性的配置,并使其易于设置重要任务(A/B测......
  • 大厂Istio基础与实践 云原生“薪”能力合集,一线大厂实战
    大厂Istio基础与实践云原生“薪”能力合集,一线大厂实战导言:上一篇章给大家介绍了服务治理方案ServiceMesh(服务网格)产生的背景、逻辑架构、应用场景。本篇将要介绍的......
  • 安装istio和部署bookinfo项目
    一istio安装1.1下载安装​​https://istio.io/latest/docs/setup/getting-started/​​安装前提:你的服务器必须可以连接外网需要下载谷歌镜像#下载cd/usr/local/curl......