- Google Cloud Platform for Architects
- Vitthal Srinivasan Janani Ravi Judy Raj
- 166字
- 2021-06-25 20:48:36
Scaling pods with the horizontal pod autoscaler
It is also possible in recent versions of Kubernetes to scale pods (rather than nodes). This also allows us to scale down to a node pool of zero, that is to scale down to zero if there is no demand for the service while also retaining the ability to scale up with demand.
Combining the two, that is, scaling in both directions allows you to make your application truly elastic. Remember that pods are a Kubernetes concept, so unsurprisingly, such autoscaling is carried out using kubectl rather than gcloud:
- To do this, you need to apply a Horizontal Pod Autoscaler (HPA) by using the kubectl autoscale command. The max flag is mandatory, while the min flag is optional. The cpu-percent indicates total CPU utilization:
kubectl autoscale deployment my-app --max=6 --min=4 --cpu-percent=50
- To check any HPA, use the kubectl describe command:
kubectl describe hpa [NAME-OF-HPA]
- Similarly, use the kubectl delete command to remove HPAs:
kubectl delete hpa [NAME-OF-HPA]
推薦閱讀
- 計算機組成原理與接口技術:基于MIPS架構實驗教程(第2版)
- 同步:秩序如何從混沌中涌現
- Python絕技:運用Python成為頂級數據工程師
- Hadoop與大數據挖掘(第2版)
- iOS and OS X Network Programming Cookbook
- Splunk智能運維實戰
- 大數據分析:數據倉庫項目實戰
- Spring MVC Beginner’s Guide
- 大數據時代系列(套裝9冊)
- 信息融合中估計算法的性能評估
- 基于數據發布的隱私保護模型研究
- ECharts數據可視化:入門、實戰與進階
- UnrealScript Game Programming Cookbook
- Hadoop與大數據挖掘
- 元宇宙基石:Web3.0與分布式存儲