首页|期刊导航|计算机技术与发展|基于负载预测的K8s水平自动伸缩优化方法研究

基于负载预测的K8s水平自动伸缩优化方法研究OA

Research on K8s Horizontal Pod Automatic Scaling Optimization Method Based on Load Prediction

中文摘要英文摘要

Kubernetes(K8s)作为主流的容器编排平台,已广泛应用于云原生及分布式系统等关键领域.然而,其原生的水平自动伸缩机制基于静态阈值的被动响应模式,在面对突发流量或负载剧增时,存在显著的扩容决策延迟.该延迟易导致应用性能瓶颈甚至服务降级,难以满足高可用性与即时响应需求.为有效克服上述时延瓶颈并提升弹性伸缩的主动性及效率,该文提出一种基于负载预测的 K8s 水平自动伸缩方法.该方法引入部署 LSTM 模型的辅助容器 Sidecar,与目标 Pod协同工作.该容器实时处理 Prometheus 监控指标流,利用 LSTM 对未来短周期的负载趋势进行动态预测.当预测值超过预警阈值时,系统主动触发扩容来取代被动响应.实验结果表明,相较原生 HPA,该方法能更精准捕捉负载变化轨迹,实现前瞻性扩容与缩容.该机制显著缩短了应用响应时间,提升了系统弹性伸缩效率与响应速度,避免了对服务器资源的浪费.

Kubernetes(K8s),a mainstream container orchestration platform,has been widely adopted in key areas such as cloud native and distributed systems.However,its native horizontal pod automatic scaling mechanism responds passively based on thresholds,resulting in significant scaling delays in the face of traffic bursts.This delay can easily lead to application performance bottlenecks and even service degradation,making it difficult to meet high availability and immediate response requirements.To effectively overcome this latency bottleneck and improve the proactive nature of automatic scaling,we propose a horizontal pod automatic scaling method based on load prediction for K8s.This method introduces an auxiliary container that deploys an LSTM model,working in conjunction with the target pod.This container processes the Prometheus monitoring metric stream in real time and uses LSTM to dynamically predict future short-term load trends.When the predicted value exceeds the warning threshold,the system proactively triggers scaling.Experimental results show that compared to the native HPA,the proposed method more accurately captures load changes,enabling proactive scaling and reduction.This mechanism significantly shortens application response time,improves system scaling efficiency and responsiveness,and avoids wasting server resources.

杨浩;沈硕;李瑞琪;王军;李荣达

国网甘肃省电力公司 数字化事业部,甘肃 兰州 730070国网甘肃省电力公司 数字化事业部,甘肃 兰州 730070国网甘肃省电力公司 数字化事业部,甘肃 兰州 730070国网甘肃省电力公司 数字化事业部,甘肃 兰州 730070国网甘肃省电力公司 数字化事业部,甘肃 兰州 730070

信息技术与安全科学

Kubernetes云原生水平伸缩负载预测长短期记忆网络

Kubernetescloud nativehorizontal scalingload predictionLSTM

《计算机技术与发展》 2026 (6)

200-206,7

甘肃省重点研发计划-工业类(23YFGA0010)国网甘肃省电力公司2025年科研成本项目(522723250008)

10.20165/j.cnki.ISSN1673-629X.2026.0014

评论