How to turn off autoscaling in Kubernetes with the kubectl command?

10/4/2016

If I set to autoscale a deployment using the kubectl autoscale command (http://kubernetes.io/docs/user-guide/kubectl/kubectl_autoscale/), how can I turn it off an go back to manual scaling?

-- Jon
kubernetes
scale

4 Answers

6/13/2017

If you follow this example and if you are not able to terminate your load generator from the terminal (by typing Ctrl+C) then deleting only hpa doesn't actually terminate your deployment. In that case, you have to delete your deployments as well. In this example, you have two deployments:

$ kubectl get deployment (run this command to see deployments)

NAME -------- DESIRED -- CURRENT -- UP-TO-DATE - AVAILABLE - AGE

load-generator      1                1                1                 1                 1           d

php-apache      1                1                1                 1                 1           d

Then execute following commands to delete your deployments:

$ kubectl delete deployment load-generator

$ kubectl delete deployment php-apache

-- Abu Shoeb
Source: StackOverflow

10/4/2016

When you autoscale, it creates a HorizontalPodScaler.

You can delete it by:

kubectl delete hpa NAME-OF-HPA.

You can get NAME-OF-HPA from:

kubectl get hpa.

-- Tony
Source: StackOverflow

7/4/2018
kubectl delete hpa ${name of hpa}

Horizontal Pod Autoscaler, like every API resource, is supported in a
standard way by kubectl. We can create a new autoscaler using kubectl create command. We can list autoscalers by kubectl get hpa and get detailed description by kubectl describe hpa. Finally, we can delete an autoscaler using kubectl delete hpa.

from official docs

-- Grigor
Source: StackOverflow

12/20/2017
kubectl delete horizontalpodautoscaler name_autoscaler_deployment -n namespace
-- Tedezed
Source: StackOverflow