Scale down Kubernetes pods

I am using

kubectl scale --replicas=0 -f deployment.yaml

to stop all my running pods. Please let me know if there are better ways to bring down all running pods to Zero keeping configuration, deployments etc.. intact, so that I can scale up later as required.


You are doing the correct action; traditionally the scale verb is applied just to the resource name, as in kubectl scale deploy my-awesome-deployment --replicas=0, which removes the need to always point at the specific file that describes that deployment, but there's nothing wrong (that I know of) with using the file if that is more convenient for you.


The solution is pretty easy and straightforward

kubectl scale deploy -n <namespace> --replicas=0 --all