How do I implement session affinity with a Ingress controller using GCE load balancer

8/31/2017

I have the following ingress config:

ingressProd.yaml

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: wordpress
  annotations:
    kubernetes.io/ingress.class: "gce"
spec:
  tls:
  - hosts:
    - ***.net
    secretName: production-tls
  rules:
    - host: ***.net
      http:
        paths:
        - path: /*
          backend:
            serviceName: wordpress
            servicePort: 80

I'm having difficulty finding resources on how to enable session affinity for the above. Having previously used a LoadBalancer service which worked as intended previously.

What do I need to investigate?

-- Chris Stryczynski
google-cloud-platform
kubernetes
load-balancing
session-affinity

1 Answer

12/4/2017

The current GCE ingress controller doesn't support session affinity. This is because it is not capable of load balancing the pods directly (It uses the nodeport service).

If you really need session affinity, the current solution is to deploy an ngnix-controller in GKE. This link contains the deployment steps.

-- Jayson Chacko
Source: StackOverflow