Reputation: 1314
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 and go back to manual scaling?
Upvotes: 35
Views: 48208
Reputation: 113
If you want to disable the effect of cluster Autoscaler temporarily then try the following method. you can enable and disable the effect of cluster Autoscaler(node level).
kubectl get deploy -n kube-system -> it will list the kube-system deployments. update the coredns-autoscaler or autoscaler replica from 1 to 0. So, the pod which is responsible for autoscaling will be terminated which means you have turned off the effect of Autoscaler. but the deployment is still there, and you can update the replica back to 1 to enable the Autoscaler effect on your cluster.
Upvotes: 2
Reputation: 113
instead of deleting the auto-scalar, if possible set min and max value nodes to same value(equal to current pods count). So that autoscaler won't do anything. if you want autoscaler feature agian then just update the min and max nodes.
Upvotes: 7
Reputation: 3049
Delete all of the HPAs within a namespace using the following command:
kubectl --namespace=MY_NAMESPACE get hpa | awk '{print $1}' | xargs kubectl --namespace=MY_NAMESPACE delete hpa
Upvotes: 2
Reputation: 599
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.
Upvotes: 15
Reputation: 431
kubectl delete horizontalpodautoscaler name_autoscaler_deployment -n namespace
Upvotes: 6
Reputation: 5152
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
Upvotes: 0
Reputation: 1194
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
.
Upvotes: 50