<p>I am developing an application that allows users to play around in their own sandboxes with a finite life time. Conceptually, it can be thought as if users were playing games of Pong. Users can interact with a web interface hosted at main/ to start a game of Pong. Each game of Pong will exist in its own pod. Since each game has a finite lifetime, the pods are dynamically created on-demand (through the Kubernetes API) as Kubernetes jobs with a single pod. There is therefore a one-to-one relationship between games of Pong and pods. Up to this point I have it all figured out.</p>

<p>My problem is, how do I set up an ingress to map dynamically created URLs, for example main/game1, to the corresponding pods? That is, if a user starts a game through the main interface, I would like him to be redirected to the URL of the corresponding pod where his game is hosted.</p>

<p>I could pre-allocate a set of urls, check if they have active jobs, and redirect if they do not, but the does not scale well. I am thinking dynamically assigning URLs is a common pattern in Kubernetes, so there must be a standard way to do this. I have looked at using nginx-ingress, but that is not a requirement.</p>

user787267
<p>I agree with <a href="https://stackoverflow.com/users/10589890/efrat-levitan">Efrat Levitan</a>. It's not the task for ingress/kubernetes itself. </p>

<p>You need another application (different layer of abstraction) to distinguish where the traffic should be routed for example istio and <a href="https://istio.io/docs/concepts/traffic-management/#routing-rule-for-http-traffic" rel="nofollow noreferrer">Routing rule for HTTP traffic</a>  based on cookies. </p>
