Skip to content

Instantly share code, notes, and snippets.

@GustavoAmerico
Created February 10, 2022 15:14
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 GustavoAmerico/c3719094778ddfb25016efb936e5bc6e to your computer and use it in GitHub Desktop.
Save GustavoAmerico/c3719094778ddfb25016efb936e5bc6e to your computer and use it in GitHub Desktop.
Scale all deployment from namespace on single line, this command should be used for scale down dev and hmo env on day off
param(
[Parameter(Mandatory=$true)][System.String] $namespace,
[Parameter(Mandatory=$true)][int]$numberOfReplicas
)
kubectl get deployments -n $namespace --output jsonpath="{range .items[*]}{.metadata.name}{'\n'}{end}" |%{
kubectl scale deployment/$_ -n $namespace --replicas $numberOfReplicas;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment