<p>I have a web solution (angular application connecting to rest services) deployed in Kubernetes. I don't use any http sessions in my solution.</p>

<p>On upgrade of my rest services, I need to have both my pods with rest service version 1 and with rest service with version 2 available. Is there any way to setup a gateway/router where I can configure my endpoints dynamically?</p>

<p>I want  <code>/myendpoint?version=1</code> to route the traffic to the group of PODs with version 1, and <code>/myendpoint?version=2</code> to route the traffic to the other group of PODs.</p>

<p>I must be able to dynamically add new endpoints without stopping the service. </p>

Elena
<h2>Separate components by deployment cycle</h2>

<p>I would recommend to separate <strong>frontend</strong> app and REST <strong>backend</strong>. (I don't know if you have this already)</p>

<p>By separation, you can roll out new versions independently, with a deployment cycle for each app.</p>

<h2>Two Deployment or N-1 compatibility</h2>

<p>In addition, if you want to have multiple versions of the same app available for a longer period, you can deploy them in two different <code>Deployment</code>s</p>

<p>e.g. Two <code>Deployment</code>, each with its own <code>Service</code> and <code>Ingress</code> that setup both.</p>

<pre><code>kind: Ingress
spec:
  rules:
  - host: foo.bar.com
    http:
      paths:
      - path: /v1/*
        backend:
          serviceName: service-v1
          servicePort: 8080
      - path: /v2/*
        backend:
          serviceName: service-v2
          servicePort: 8080
</code></pre>

<p>Or you can have <strong>N-1</strong> compatibility, so version 2 implements both <code>/v1/</code> and <code>/v2/</code> API.</p>

<h2>Consider using CDN for static assets</h2>

<p>It is usually recommended to deploy frontend on a CDN since it is <strong>static</strong> content. Sometimes your Javascript refers to other Javascript files using <a href="https://www.keycdn.com/support/what-is-cache-busting" rel="nofollow noreferrer"><em>cache busting</em></a>, then it is much easier to handle such setup if all your static content is available from a CDN. </p>
