Skip to content

Instantly share code, notes, and snippets.

@DSdatsme
Last active August 20, 2020 20:10
Show Gist options
  • Save DSdatsme/669abd616148f5d729958f9d3a4e7535 to your computer and use it in GitHub Desktop.
Save DSdatsme/669abd616148f5d729958f9d3a4e7535 to your computer and use it in GitHub Desktop.
this oneliner will scale down your all deployments except the regex specified in if condition in the specific namespace.
for i in $(kubectl get deploy -n <namespace> -o name); do if [[ ${i} != (*"mongodb"*|*"mysql"*) ]];then kubectl scale -n <namespace> --replicas 0 $i; fi; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment