<p>I am using kubernetes 1.9.2 created but kubeadm.
this kubernetes cluster is running in 4 ec2 nodes.</p>

<p>I have a deployment that requires using cache in every pod.
in order to accomlish that we used session affinity from ClusterIP.</p>

<p>since I was ELB in front of my Kubernetes cluster I wonder how the session affinity is behaving.</p>

<p>the natural behavior would be that for every client IP a different will get the requests but given the traffic is transferred via ELB , whoch IP does the session affinity recognizes , the ELB IP or the actual Client IP?</p>

<p>when I check the traffic to the pods I see that 102 pods get all the requests and the 2 other pods are just waiting.</p>

<p>many thanks for any help.</p>

<p><code>SessionAffinity</code> recognizes Client IP and ELB should pass the Client IP.</p>

<p>I think you should work with <a href="https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/x-forwarded-headers.html" rel="nofollow noreferrer">HTTP Headers and Classic Load Balancers</a> and setup <code>X-Forwarded-For: client-ip-address</code></p>

<p>Also, this seems to be a know issue <a href="https://github.com/kubernetes/ingress-nginx/issues/3056" rel="nofollow noreferrer">enabling Session affinity goes to a single pod only #3056</a>.</p>

<p>It was reported for <code>0.18.0</code> and <code>0.19.0</code> version of NGINX Ingress controller.</p>

<p>Issue was closed and commented that is was fixed in version <code>0.21.0</code>, but in December initial author said it still doesn't work for him.</p>
