We have a service that runs on 3 to 5 pods that connect to a database. Every time the user enters the domain, and once logged in, shortly, we are forced to reload and go back to the login screen. It does not happen with 1 pod. Without multiple pods, it tries to go to another pod once after login and goes back to login screen.
We have a simple Gateway > VirtualService > DestinationRule setup for this application
apiVersion: networking.istio.io/v1beta1
kind: Gateway
metadata:
name: our-gateway
spec:
selector:
istio: ingressapp
servers:
- hosts:
- app.com
port:
name: http
number: 80
protocol: HTTP
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: our-virtualservice
spec:
gateways:
- our-gateway
hosts:
- app.com
http:
- match:
- uri:
prefix: /
route:
- destination:
host: app
port:
number: 8080
apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
name: destinationrule
spec:
host: app.com
trafficPolicy:
loadBalancer:
consistentHash:
useSourceIp: true
tls:
mode: ISTIO_MUTUAL
This stickiness does not work. I had also tried:
consistentHash:
httpCookie:
name: user
ttl: 0s
httpCookie also did not work.
What is blocking it from working? Using DestinationRule still doesn't enable any stickiness and had no effect.
For session stickiness to reflect add ttl with some value. currently you are setting 0s, try with ttl: 500s