DEV Community

Hemanth B
Hemanth B

Posted on • Edited on

1

Scale down specific multiple deployments in kubernetes

In kubernetes, if there are multiple deployment like 5000 deployments deployed in kubernetes v1.20.0, and in that around 800 deployments where migrated from kubernetes v1.20.0 to v1.22.0,
When it need to scale down to zero only for 800 deployment.

We can use below shell script to scale down to zero for specific deployment.

First list 800 specific deployments details should be listed below in the deploy.list file

vi /tmp/deploy.list

abc-xyz-service
nyx-api-service
jkx-graphql-api-service
java-jws-service
dotnet-ams-service
xyz-python-service
...
Enter fullscreen mode Exit fullscreen mode

Execute below shell script to scale down the deployments to zero.

for pods in `cat /tmp/deploy.list`
do
    kubectl scale --replicas=0 $pods
done
Enter fullscreen mode Exit fullscreen mode

This should scale down the replicas of specific multiple deployments.

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more