Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
isno committed Jan 12, 2024
1 parent e82a004 commit 61b1814
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
1 change: 0 additions & 1 deletion .vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export default defineUserConfig({
}
],
sidebar: [
'/intro.md',
'/noun.md',
{
text: '第一章:云原生技术概论',
Expand Down
1 change: 1 addition & 0 deletions assets/HPA.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 5 additions & 6 deletions container/auto-scaling.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# 7.8 弹性伸缩

弹性伸缩意思通过应用云计算弹性伸缩的功能实现业务量增减资源的合理应用,对于弹性伸缩的意义,总结来说
弹性伸缩意思通过应用云计算弹性伸缩的功能实现业务量增减资源的合理应用,驱动弹性的背景总结来说

- 峰值负载应对:促销活动、节假日购物季或突发事件根据需求快速扩展资源,保证应用可用性和性能。
- 提高资源利用率:根据实际资源负载动态调整资源规模,避免基础设施资源浪费,降低 TCO。
- 提高资源利用率:根据实际资源负载动态调整资源规模,避免基础设施资源浪费,降低 TCO(Total Cost of Ownership,总体拥有成本)
- 应对故障和容错:多实例部署和快速替换,提高业务连续性和可用性。
- 跟随需求变化:匹配前端的业务需求及压力,快速调整规模,提高事件应对能力,满足需求和期望


## Horizontal Pod Autoscaling

Expand All @@ -15,10 +13,11 @@ Kubernetes 自身提供一种弹性伸缩的机制,包括 Vertical Pod Autosca
HPA 依赖 Metrics-Server 捕获 CPU、内存数据来提供资源使用测量数据,也可以根据自定义指标(如 Prometheus)进行扩缩。

<div align="center">
<img src="../assets/HPA.png" width = "600" align=center />
<img src="../assets/HPA.svg" width = "500" align=center />
</div>

由上图看出,HPA 持续监控 Metrics-Server 的指标情况,然后计算所需的副本数动态调整资源副本,实现设置目标资源值的水平伸缩。
由上图看出,HPA 持续监控 Metrics-Server 的指标情况,根据收集到的 Pod 资源的 metrics 计算除所需的副本数并进行动态调整资源副本,实现设置目标资源值的水平伸缩。


下面示例,创建一个 HPA, 期望 CPU 的利用率为 70%,副本数的范围是 1-10,操作对象名 nginx-deployment 为 Deployment 。

Expand Down

0 comments on commit 61b1814

Please sign in to comment.