0

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
  • 30,145
  • 48
  • 175
  • 286
  • A possible work around is to just set the session affinity on the google load balancer directly from the Google Cloud Console. – Chris Stryczynski Sep 01 '17 at 07:11
  • Chris this requires you to create a new Load Balancer however, incurring additional costs, when the Ingress using `gce` should do it already. Any other workarounds? My config is nearly identical to yours above but I use the `kube-lego` SSL cert provisioning and the `acme` annotation. – Mike S. Oct 24 '17 at 16:58
  • I haven't found a solution to this yet. The workaround doesn't actually work in addition unfortunately. – Chris Stryczynski Oct 24 '17 at 17:36
  • I used the `LoadBalancer` as well for dev and then packaged everything and used Ingress. So far I haven't seen a session drop off, and back end apps are `Deployment` and exposed service for each is a `NodePort` type with `Ingress` front end. What I do get without any way to find error log is the 502 "check back in 30 seconds" page error from time to time and don't think the session stickiness is cause. If any epiphanies on affinity please update here. – Mike S. Oct 25 '17 at 03:02

1 Answers1

2

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
  • 2,388
  • 1
  • 11
  • 16