<p>lets say, we have two independent Kubernetes clusters <code>Cluster 1 &amp; Cluster 2 </code>, Each of them has two replicas of same application Pod. Like
<code>Cluster 1 : Pod A &amp; Pod B</code>
<code>Cluster 2 : Pod C &amp; Pod D</code>
Application code in Pod A(client) wants to connect to any Pod running in cluster 2 via NodePort/Loadbalancer service over UDP protocol to send messages. The only requirement is, to maintain affinity so that all messages from Pod A should go to any one pod only (either Pod C or Pod D). Since, UDP is a connectionless protocol, my concern is around the session Affinity based on ClientIP. Should setting the sessionAffinity as client IP solve my issue ?</p>

<blockquote>
<p>Since, UDP is a connectionless protocol, my concern is around the session Affinity based on ClientIP. Should setting the sessionAffinity as client IP solve my issue ?</p>
</blockquote>
<p><code>sessionAffinity</code> keeps each session based on sourceIP regardless of the protocols at the same cluster. But it does not mean your real session is kept as you expected on your env across your whole access path journey.
<strong>In other words, just only using sessionAffinity does not ensure keeping whole session on your access paths.</strong></p>
<p>For example, Pod A outbound IP is translated as running node IP(SNAT) if you does not use egress IP solutions for the Pod A.
It also depends your NodePort and LoadBalancer Service config about source IP in cluster 2. Refer <a href="https://kubernetes.io/docs/tutorials/services/source-ip/" rel="nofollow noreferrer">Using Source IP</a> for more details.</p>
<p>So you should consider how to keep session safely while accessing each other between other clusters. Personally I think you had better consider application layer(7Layer) sticky session for keeping the session, not sessionAffinity of the service.</p>
