<p>My cluster has one master and two slaves(not on any cloud platform), and I create a deployment with 2 replicas so each slave has one pod, the image I’m running is tensorflow-jupyter. Then I create a NodePort type service for this deployment and I thought I can separately run these two pods at the same time, but I was wrong.</p>
<p>Tensorflow-jupyter have to use token it gives to login, everything is fine if there has only 1 pod, but if the replicas is 2 or more, it will have server error after login and logout by itself after I press F5, then I can’t use the token to login anymore. Similar situation happens to Wordpress, too.</p>
<p>I think I shouldn’t use NodePort type to doing this, but I don’t know if other service type can solve this problem. I don’t have load balancer to try and I don’t know how to use ExternalName.</p>
<p>Is there has any way to expose a service for a deployment with 2 or more replicas(one pod per slave)? Or I only can create a lot of deployments all with 1 pod and then expose same amount of services for each deployment?</p>

Johnnyee
<p>It seems the application you're trying to deploy requires sticky session support: this is not supported out-of-the-box with the <code>NodePort</code> Service, you have to go for exposing your application using an Ingress resource controlled by an Ingress Controller in order to take advantage of the reverse-proxy capabilities (in this case, the sticky-session).</p>
<blockquote>
<p>I'm not suggesting you use the <code>sessionAffinity=ClientIP</code> Service option since it's allowed only for <code>ClusterIP</code> Service resources and according to your question it seems the application has to be accessed outside of the cluster.</p>
</blockquote>
