[root@k8s-master 11-cluster-loadbalancing]# kubectl apply -f destinationrule-demoapp.yaml
destinationrule.networking.istio.io/demoapp configured
[root@k8s-master 11-cluster-loadbalancing]# cat destinationrule-demoapp.yaml
apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
name: demoapp
spec:
host: demoapp
trafficPolicy:
loadBalancer:
simple: LEAST_CONN
subsets:
- name: v10
labels:
version: v1.0
trafficPolicy:
loadBalancer:
consistentHash:
httpHeaderName: X-User
- name: v11
labels:
version: v1.1
直接curl 请求结果是轮询的
我们加入了X-User标头,可以看到请求结果一只被绑定了。
标签:destinationrule,cluster,labels,调度,demoapp,算法,io,name From: https://www.cnblogs.com/zyyang1993/p/16613499.html