Istio session affinity with weighted load balancer

11/8/2018

I'm trying to implement session stickiness with Istio weighted load balancing, but Istio ignores session configuration. What I do:

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

I've also tried to set trafficPolicy into the spec section, but got the same result. It sets the cookie, and I can see x-canary-user in my browser requests with no load balancing affection

-- dshmatov
istio
kubernetes

1 Answer

11/9/2018

It might not merging to master yet. https://github.com/istio/istio/pull/6742 I've provided to you link to pull request which is should cover this but tests are failed. We should wait for new release.

-- Nick Rak
Source: StackOverflow