virtualservice权重
应用virtualservice
[root@k8s-master 06-weight-based-routing]# kubectl apply -f virtualservice-demoapp.yaml
[root@k8s-master 06-weight-based-routing]# cat virtualservice-demoapp.yaml
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: demoapp
spec:
hosts:
- demoapp
http:
- name: weight-based-routing
route:
- destination:
host: demoapp
subset: v10
weight: 90
- destination:
host: demoapp
subset: v11
weight: 10
while true; do curl demoapp:8080; sleep 0.$RANDOM; done
可以看到基本是按照9/1进行分配的
也直接vim直接修改VS,然后apply一下,就能在线修改权重了