I was wondering what the correct way to split traffic with x % to deployment A and y % to deployment B is. In the kodekloud learning platform, they suggested, to just scale the number of replicas from A and B to certain numbers of replicas in order to obtain the desired ratio. But what if I want a 90% and 10% traffic split without having to spin up 9 replicas on deployment A and have only 1 for deployment B ? I wasn’t able to find anything about this topic in the documentation, I’ve only found third party extensions for this, but I would like to stick with the native api. Can the ingresses be configured somehow in order to do this?
CodePudding user response:
Currently such behavior isn't provided by native K8s API's. You can "fake" this by using two different Deployments with Labels that match one Service, however as you've already mentioned this only works if you have a certain amount of Pods running and is not really scaleable in any way.
You can use a "third party" such as Argo Rollouts for such cases: https://argoproj.github.io/argo-rollouts/concepts/#canary
Also some Ingress Controller's such as the NGINX Ingress Controller supports Canary releases: https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#canary
That being said, there's nothing wrong with using third party products especially such as Argo, which recently graduated to Graduated in CNCF.