Skip to content

Instantly share code, notes, and snippets.

@mikerodionov
Last active September 21, 2022 14:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikerodionov/f49d563d2ece1e8f977de966fde64851 to your computer and use it in GitHub Desktop.
Save mikerodionov/f49d563d2ece1e8f977de966fde64851 to your computer and use it in GitHub Desktop.
Scale down all Kubernetes deployments except specified
# This script will scale down all deployments except for specified in grep condition
kubectl get deploy -n NAMESPACE-NAME | grep -v 'deploymentA\|deploymentB\|deploymentC' | awk '{print $1}' | while read line; do
#echo $line
kubectl scale deploy $line --replicas=0
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment