Scale down the Cluster
This lesson focuses on how to scale down the Cluster and the rules which govern it.
We'll cover the following...
Scale down the nodes #
Scaling up the cluster to meet the demand is essential since it allows us to host all the replicas we need to fulfill (some of) our SLAs. When the demand drops and our nodes become underutilized, we should scale down. That is not essential given that our users will not experience problems caused by having too much hardware in our cluster. Nevertheless, we shouldn’t have underutilized nodes if we are to reduce expenses. Unused nodes result in wasted money. That is true in all situations, especially when running in Cloud and paying only for the resources we used. Even on-prem, where we already purchased hardware, it is essential to scale down and release resources so that they can be used by other clusters.
We’ll simulate a decrease in demand by applying a new definition that will redefine the HPAs
threshold to 2
(min) and 5
(max).
kubectl apply \
-f scaling/go-demo-5.yml \
--record
kubectl -n go-demo-5 get hpa
The output of the latter command is as follows.
NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE
api Deployment/api 0%/80%, 0%/80% 2 5 15 2m56s
db StatefulSet/db 56%/80%, 10%/80% 3 5 3 2m57s
We can see that the min and max values of the api
HPA
changed to 2
and 5
. The current number of replicas is still 15
, but ...