Kubernetes - how to set session affinity when using GCP with multiple nodes?

10/6/2017

So I have a kubernetes configuration that has two nodes, this in turn creates two load balancer backend services (within GCP).

How can I have session affinity functionality between BOTH backend services?

I thought I would be able to delete the second backend service, and then add the second generated 'backend' to the first backend service - but I'm not sure if this is feasible / possible.

-- Chris Stryczynski
google-cloud-platform
kubernetes

1 Answer

10/11/2017

The load balancing is done by the service. So I think you just need a service and behind it some pods (ReplicaSet or Deployment with targeted labels).

About how to make session affinity works, you probably need an ingress with an affinity cookie. In the ingress Kubernetes repository there is an example (here).

-- pipo02mix
Source: StackOverflow