K8s Deploy Yaml with scaling replicas count on the fly

Viewed 261

How to upgrade an existing running deployment with yaml deployment file without changing the number of running replicas of that deployment? So, I need to set the number of replicas on the fly without changing the yaml file.

It is like running kubectl apply -f deployment.yaml along with kubectl scale --replicas=3 both together, or in another wards to apply deployment yaml changes with keeping the numebr of running replicas the same as it is.

For example: I have a running deployment which already scaled its pods to 5 replicas, need to change deployment parameters within CD (like upgrade container image, change environment variabls, .. etc) without manualy check the #running pods and update the yaml with it, how can achieve this?

1 Answers
Related