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

885 Views Asked by At

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?

1

There are 1 best solutions below

0
On

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.