安装istio1.5.1并部署bookinfo示例程序
https://istio.io/docs/setup/getting-started/
体验
部署bookinfo-gateway
apiVersion: networking.istio.io/v1beta1 kind: Gateway metadata: name: bookinfo-gateway namespace: default spec: selector: istio: ingressgateway servers: - hosts: - '*' port: name: http number: 80 protocol: HTTP
部署productpage服务的virtualservice,并绑定bookinfo-gateway
apiVersion: networking.istio.io/v1beta1 kind: VirtualService metadata: name: productpage namespace: default spec: gateways: - bookinfo-gateway hosts: - '*' http: - match: - uri: prefix: /productpage - uri: prefix: /static route: - destination: host: productpage port: number: 9080 timeout: 10s
修改deploy/istio-ingressgateway以使用hostNetwork,通过nodeIp:80端口访问productpage
nodeIp=$(kubectl describe pod istio-ingressgateway -n istio-system | grep ^IP: | awk '{print $2}')
http://nodeIp/productpage?u=test
不断访问productpage
for i in `seq 1 10000`; do curl -o /dev/null http://nodeIp/productpage?u=test ; done
从kiali查看流量情况(app graph)
从kiali查看流量情况(versioned app graph),可以看到reviews的3个版本均有处理流量,原因为reviews这个svc通过通过label selector选择了三个版本的reviews pod