This is to ensure we are always on top of the users’ mind.
Tag: stickiness
Session Stickiness in a Stateful Microservice
I have created a simple Spring Boot Microservice for a game of Rock Paper Scissors. It involves in memory storage of registered players as well as the rounds that they play. Now, if I have to use it with a frontend in a scalable cloud environment I am going to require session stickiness. There are unique ids to players as well as the session that the two opponents play with. How can I ensure session stickiness when I have multiple instances of this microservice running in my cluster ?
Achieving stickiness on kubernetes cluster with ingress-gce
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: {}