<p>I have a single page app. It is served by (and talks to) an API server running on a Kubernetes deployment with 2 replicas. I have added a <code>X-API-Version</code> header that my API sends on every request, and my client can compare with, to figure out if it needs to inform the user their client code is outdated.</p>
<p>One issue I am facing however, is when I deploy, I want to ensure only ever 1 version of the API is running. I do not want a situation where a client can be refreshed many times in a loop, as it receives different API versions.</p>
<p>I basically want it to go from 2 replicas running version A, to 2 replicas running Version A, 2 running version B. Then switch the traffic to version B once health checks pass, then tear down the old version A's.</p>
<p>Does Kubernetes support this using the <code>RollingDeploy</code> strategy?</p>

Dominic Bou-Samra
<p>For blue-green deployment in Kubernetes, I will recommend to use some third party solution like <a href="https://argoproj.github.io/argo-rollouts/" rel="nofollow noreferrer">Argo Rollouts</a>, <a href="https://docs.nginx.com/nginx-service-mesh/tutorials/trafficsplit-deployments/" rel="nofollow noreferrer">NGINX</a>, <a href="https://docs.harness.io/article/1qfb4gh9e8-set-up-kubernetes-traffic-splitting" rel="nofollow noreferrer">Istio</a> etc.. They will let you split the traffic between the versions of your application.</p>
<p>However, Kubernentes is introducing <a href="https://kubernetes.io/blog/2021/04/22/evolving-kubernetes-networking-with-the-gateway-api/" rel="nofollow noreferrer">Gateway API</a> which has built-in support for <a href="https://gateway-api.sigs.k8s.io/guides/traffic-splitting/" rel="nofollow noreferrer">traffic splitting</a>.</p>
