作者投稿和查稿 主编审稿 专家审稿 编委审稿 远程编辑

计算机工程 ›› 2024, Vol. 50 ›› Issue (9): 82-91. doi: 10.19678/j.issn.1000-3428.0068453

• 人工智能与模式识别 • 上一篇    下一篇

基于Kubernetes的集群节能策略研究

李俊俊*(), 董建刚, 李坤   

  1. 新疆大学软件学院, 新疆 乌鲁木齐 830091
  • 收稿日期:2023-09-25 出版日期:2024-09-15 发布日期:2024-01-25
  • 通讯作者: 李俊俊

Research on Kubernetes-based Cluster Energy-Saving Strategy

LI Junjun*(), DONG Jiangang, LI Kun   

  1. School of Software, Xinjiang University, Urumqi 830091, Xinjiang, China
  • Received:2023-09-25 Online:2024-09-15 Published:2024-01-25
  • Contact: LI Junjun

摘要:

在Kubernetes中, HPA具备自动扩展Pod的能力, 它可以根据流量的波动情况, 在高峰时增加Pod数量以应对需求, 而在低谷时减少数量以节省资源。然而, 由于HPA是根据当前Pod的性能指标来进行扩展的, 当流量激增时, 可能会对应用服务的可用性产生不利影响, 并且当压力较小时, 算力资源的空载会导致电子资源的浪费。针对上述问题, 研究并验证一种基于时序预测的集群资源自动缩放与智能休眠唤醒策略, 使用GC-TimesNet模型对集群资源的使用情况进行预测。当资源利用率较低时, 计算出需要关闭的算力节点数量, 将这些节点设置为不可调度状态, 并驱逐节点现有的Pod, 然后将这些机器置于睡眠状态。相反, 当资源需求增加时, 会唤醒足够数量的机器, 并通过HPA控制器增加所需数量的Pod副本。实验结果表明, 该策略能够较为准确地预测集群负载的变化趋势, 结合实施智能的休眠与唤醒策略, 提升优化集群的运维管理能力, 最大程度地提高计算资源的利用率, 为降低集群能源开销提供数据支撑, 实现节能减排。

关键词: Kubernetes工具, 容器编排, 集群节能, 时间序列预测, GC-TimesNet模型, 卷积神经网络, 注意力机制, 节能减排

Abstract:

Within Kubernetes, the Horizontal Pod Autoscaler(HPA) possesses automatic Pod-scaling capability, adjusting the number of Pods based on fluctuations in traffic, increasing the Pod count during peak periods to meet demand, and reducing it during off-peak times to conserve resources. However, because HPA scales are based on the current performance metrics of Pods, sudden traffic surges can potentially have detrimental effects on the availability of application services. In addition, during periods of low demand, idle computing resources lead to a waste of resources. To address these challenges, this study investigates and validates cluster resource autoscaling and intelligent sleep-wake strategy based on time-series forecasting. This strategy utilizes the GC-TimesNet model to predict cluster resource usage. When resource utilization is low, the strategy calculates the number of compute nodes that need to be shut down, marks these nodes as unschedulable, evicts existing Pods, and places these machines in a sleep state. Conversely, when the resource demand increases, a sufficient number of machines are awakened, and the HPA controller is used to increase the required number of Pod replicas. The experimental results demonstrate that this strategy can reasonably and accurately predict trends in cluster load changes, enhance the operational management capabilities for optimizing clusters, maximize the utilization of computing resources, provide data support for reducing cluster energy expenses, and achieve energy savings and emission reduction when combined with the implementation of intelligent sleep and wake strategies.

Key words: Kubernetes tool, container orchestration, cluster energy-saving, time series forecasting, GC-TimesNet model, convolutional neural network, attention mechanism, energy saving and emission reduction