0

I have a Kubernetes service at GKE. Currently it has Session Affinity:ClientIP. and in GCP Load Balancer Console, it is shown as "Client IP"

What value should I set it as so that in GCP Load Balancer Console, it will be shown as "Client IP, Port and Protocol"?

All the documents I saw mention that Session Affinity can be assigned as "ClientIP" or "no" (by default). none of them tell me there is a third option, while if you check GCP Load balancer, it has multiple options for Session Affinity: None; Client IP; Client IP and Protocol; Client IP, Port and Protocol

this is the service file:

---
apiVersion: v1
kind: Service
metadata:
  namespace: test
  name: test
  annotations:
    cloud.google.com/load-balancer-type: Internal
spec:
  type: LoadBalancer
  ports:
    - port: XXX
      protocol: TCP
      targetPort: XXX
      name: XXX
  selector:
    app: XXX
  sessionAffinity: ClientIP
user389955
  • 9,605
  • 14
  • 56
  • 98

1 Answers1

0

Session affinity, sometimes referred to as sticky sessions, associates all requests coming from an end-user with a single pod. This means that all traffic from a client to a pod will be directed to the same pod.

If you want to make sure that connections from a particular client are passed to the same Pod each time, you can select the session affinity based on the client's IP addresses by setting service.spec.sessionAffinity to "ClientIP"

From the Latest Kubernetes API ServiceSpec v1 core:

sessionAffinity

Supports "ClientIP" and "None". Used to maintain session affinity. Enable client IP based session affinity. Must be ClientIP or None. Defaults to None. More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies

So, ClientIP or None - you dont have 3rd choice.

Vit
  • 7,740
  • 15
  • 40