Skip to content

Instantly share code, notes, and snippets.

@Spazzy757
Last active February 15, 2021 12:54
Show Gist options
  • Save Spazzy757/58c19c013f2c1e4e1920b6d0b91a2ccc to your computer and use it in GitHub Desktop.
Save Spazzy757/58c19c013f2c1e4e1920b6d0b91a2ccc to your computer and use it in GitHub Desktop.
This is a very simple example of how to create a sticky session configuration for a application running behind istio
---
apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
name: <app-name>
spec:
host: <app-name>.<app-namespace>.svc.cluster.local
trafficPolicy:
loadBalancer:
consistentHash:
httpCookie:
name: cookie
path: <cookie to use for sessions>
ttl: "3600s"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: <app-name>
namespace: istio-system
spec:
hosts:
- <host>
gateways:
- <gateway-name>
http:
- match:
- uri:
prefix: /
route:
- destination:
port:
number: 80
host: <app-name>.<app-namespace>.svc.cluster.local
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment