Let's say you have a CI/CD pipeline, and as part of that pipeline you have a deployment manifest file where you change some values and redeploy.
On the other hand your deployment is also horizontally autoscaled which works by modifying your deployment manifest file to scale up to the replicas you set it to.
Then one day your horizontal autoscaler has spun 40 pods to meet demand and you go and run your pipeline which has a deployment manifest set to one replica. The moment you apply this file, it will kill all your pod replicas, meaning your scaler would need to bring them back up, this could potentially affect data and service, which is not good.
How can you apply a manifest file so it doesn't affect your scaled replicas? All I can think of is automating a check of the number of replicas and change the deployment manifest to reflect that, but that seems like an extremely ugly solution.
I am guessing there must a better solution to this, I just couldn't find it, or maybe I am looking in the wrong places...