Score:0

Send traffic to only one Ingress Controller Pod

us flag

I am using HA Proxy as my Ingress Controller. It is setup with 2 replicas. Meaning traffic reaching the Ingress Controller LB service can be routed to 2 pods.

My end user application has 3 replicas. The end user service is configured with sessionAffinity:ClientIP meaning that sessions between ingress controller pods and application pods are session stuck.

This causes an issue when the 2 ingress controller pods route traffic to 2 different application pods. The end user session is not maintained and the user gets logged out suddenly.

enter image description here

What would be ideal in this case would be

enter image description here

One option is to introduce sessionAffinity:ClientIP on the Ingress Ctrl LB too but that would affect every application in the cluster.

How can I make sure that for my specific application, the request persistently hits just one Ingress Controller pod ?

Current Ingress definiton

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    haproxy.org/backend-config-snippet: |
      dynamic-cookie-key Ingress
      cookie INGRESSCOOKIE insert indirect nocache dynamic
    kubernetes.io/ingress.class: haproxy
  name: cache
  namespace: cache
spec:
  rules:
  - host: ac.com
    http:
      paths:
      - backend:
          service:
            name: nexus
            port:
              number: 8080
        path: /
        pathType: Prefix
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.