参考文档:https://istio.io/latest/zh/docs/tasks/traffic-management/request-timeouts/
1、将请求路由到 reviews
服务的 v2 版本,它会发起对 ratings
服务的调用
apiVersion: networking.istio.io/v1alpha3 kind: VirtualService metadata: name: reviews spec: hosts: - reviews http: - route: - destination: host: reviews subset: v2
2、给对 ratings
服务的调用添加 2 秒的延迟:
apiVersion: networking.istio.io/v1alpha3 kind: VirtualService metadata: name: ratings spec: hosts: - ratings http: - fault: delay: percent: 100 fixedDelay: 2s route: - destination: host: ratings subset: v1
这时可以看到 Bookinfo 应用运行正常(显示了评级的星型符号),但是每次刷新页面,都会有 2 秒的延迟。