As per the question, the ruby deployment has 5 replicas and it should not be changed and we have to determine the number of replicas for the cube deployment to pass not more than 40% of traffic to it. how did we reach to the conclusion that the new deployment should have 2 replicas. Please help in understanding, as it says in the solution minimum 2
.
So this is about blue-green and canary techniques where you have one service that includes the pods of two deployments. Recall that a service distributes traffic equally amongst all pods that it is connected with.
When we start, there are 5 pods in each deployment, total 10. Each of those pods receives the same amount of traffic, meaning that each deployment will get 50% since both deployments have the same number of pods.
If we scale one of these deployments to 2 replicas then there are now 7 pods in total connected with the service
So cube-alpha-apd
will now receive 2/7 = 28.5% of traffic which is less than 40%.
The formula for the percentage traffic a deployment receives when one service includes more than one deployment is
replicas in deployment
-------------------------------- x 100
total # pods included by service