I'm trying to achieve stickiness on kubernetes cluster but I am redirected to a different pod every time I access the load balancer. I have session affinity set to 'ClientIP' and also tried with 'Generated Cookie'.
I have the following backend Service set up:
apiVersion: v1
kind: Service
metadata:
annotations:
beta.cloud.google.com/backend-config: '{"ports": {"80":"test-backendconfig"}}'
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"v1","kind":"Service","metadata":{"annotations":{"beta.cloud.google.com/backend-config":"{\"ports\": {\"80\":\"test-backendconfig\"}}"},"labels":{"app":"test","tier":"frontend"},"name":"test","namespace":"default"},"spec":{"ports":[{"name":"backend-port","port":80,"targetPort":5000}],"selector":{"app":"test","tier":"frontend"},"sessionAffinity":"ClientIP","type":"NodePort"}}
creationTimestamp: 2018-12-31T18:01:26Z
labels:
app: test
tier: frontend
name: test
namespace: default
resourceVersion: "..."
selfLink: /api/v1/namespaces/default/services/test
uid: ...
spec:
clusterIP: 10.**.***.***
externalTrafficPolicy: Cluster
ports:
- name: backend-port
nodePort: 32385
port: 80
protocol: TCP
targetPort: 5000
selector:
app: test
tier: frontend
sessionAffinity: ClientIP
sessionAffinityConfig:
clientIP:
timeoutSeconds: 10800
type: NodePort
status:
loadBalancer: {}