How to load balance with Kubernetes Services - not the ClientIP strategy

6/25/2019

My services / pods are running behind a service, but I do not have an Ingress controller. The Request is coming from GTM -> LTM -> K8s service -> Pod. Here LTM is overriding the clientIP. Due to this, SessionAffinity with ClientIP strategy is not working.

kind: Service
metadata:
  creationTimestamp: null
  name: active
  selfLink: /api/v1/namespaces/active
spec:
  externalTrafficPolicy: Cluster
  ports:
  - name: port1
    nodePort: 35010
    port: 80
    protocol: TCP
  selector:
    name: active-pod
  sessionAffinity: ClientIP
  sessionAffinityConfig:
    clientIP:
      timeoutSeconds: 10800
  type: LoadBalancer
status:
  loadBalancer: {}

I have SMCookie in the request. Is there a way I can load balance with cookie in the K8s Service. Or suggest some other options..

-- super-coder
docker
kubernetes
kubernetes-service
load-balancing
session-affinity

0 Answers