Is it possible to split traffic by fixed ratio among two Deployments using only Service
Context: Kubernetes (1.23), 2 Deployments of the same app with different version/config/etc., 1 Service
Let's say I have a web application deployed in Kubernetes using a Deployment. I want to add a new (canary, A/B testing) version of the same app as a new separate Deployment, so we're not touching the original Deployment. I want to set fixed ratio of traffic between these two Deployments.
Is it possible to achieve this using Service, or other Kube native objects? (Not by utilizing a service mesh).
Closest solution I found so far is creating those two deployments with such number of pod replicas, that corresponds to the required ratio (or close to it). I.e. if the required ratio is 7:3, Deployment A would have 7 pods, Deployment B would have 3. Service being simple round-robin, should ensure the requests spread according to the ratio.
It's not a very elegant solution though, this might be quite a big waste of resources in some cases.