Docs/CloudNative/Kubernetes/Base/HPA.md
2022-10-18 16:59:37 +08:00

18 lines
No EOL
799 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

horizontal pod autoscaling可以根据cpu使用率或自定应metrics自动扩展pod支持rsdeployment
控制器每隔30s可以通过--horizontal-pod-autoscaler-sync-period 修改查询metrics的资源使用情况
支持三种metrics类型
预定义metrics比如 Pod 的 CPU以利用率的方式计算
自定义的pod metrics以原始值raw value的方式计算
自定义的object metrics
支持两种metrics的查询方式heapster和自定义的RESTful API
支持多metrics
使用hpa之前需要确保已部署好metrics-server
```
## 创建pod与service
kubectl run php --image=php --requests=cpu=200m --expose --port=80
## 创建autoscaler
kubectl autoscale deployment php --cpu-percent=50 --min=1 --max=10
```