Take Down all the Services Which are Deployed in Kubernetes by Imperative Way

How to scale down all the deployments with imperative way

To take down the services deployed by Kubernetes, this oneliner is pretty handy in some situations despite being too cluttered command… But it does work in situations.

% kubectl get deployments | awk '{print $1}' | grep -v "NAME" | while read f; 
do
    kubectl scale deployment $f --replicas=0;
done