我正在尝试使用Istio加权负载平衡实现会话粘性,但Istio忽略了会话配置。我的工作:
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: test-app-vs
namespace: demo
spec:
gateways:
- test-app-gw
hosts:
- "demo-app.test.cloud"
http:
- route:
- destination:
host: test-app.demo.svc.cluster.local
subset: v1
weight: 50
- destination:
host: test-app.demo.svc.cluster.local
subset: v2
weight: 50
---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: test-app-dr
namespace: demo
spec:
host: test-app.demo.svc.cluster.local
subsets:
- name: v1
labels:
version: v1
app: test-app
trafficPolicy:
loadBalancer:
consistentHash:
httpCookie:
name: x-canary-user
ttl: 0s
- name: v2
labels:
version: v2
app: test-app
trafficPolicy:
loadBalancer:
consistentHash:
httpCookie:
name: x-canary-user
ttl: 0s
我也尝试将trafficPolicy
设置为spec
部分,但是得到了相同的结果。它设置了cookie,我可以在浏览器请求中看到x-canary-user
,而没有负载平衡的影响
答案 0 :(得分:0)
它可能尚未合并到母版。 https://github.com/istio/istio/pull/6742 我已提供给您指向拉取请求的链接,该请求应涵盖此问题,但测试失败。我们应该等待新版本的发布。