上QQ阅读APP看书,第一时间看更新
Scaling nodes with the cluster autoscaler
For automatic resizing of your clusters based on nodes, you need to use something known as the cluster autoscaler. This will periodically check and optimize the size of your cluster, either increasing or reducing the number of instances. Let's say that your container cluster is larger than it needs to be and there are nodes that do not have any pods scheduled, those nodes will be deleted by the cluster autoscaler. On the other hand, if your cluster container is too small and if you have pods that are facing inordinate delays before they are run, the cluster autoscaler will add nodes and scale up your cluster:
gcloud container clusters create [CLUSTER-NAME] --num-nodes=5 \
--enable-autoscaling --min-nodes=3 --max-nodes=10 [--zone=[ZONE] \ --project=[PROJECT-ID]]
Notice how the scaling of nodes is carried out using gcloud (not kubectl).