其他分享
首页 > 其他分享> > istio功能体验

istio功能体验

作者:互联网

安装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

 

标签:功能,http,体验,istio,bookinfo,productpage,nodeIp,gateway
来源: https://www.cnblogs.com/orchidzjl/p/12862879.html