云原生成本优化——CronHPA
云原生成本优化
·
CronHPA
通过配置定时弹性伸缩(CronHPA)提高资源利用率
使用CronHPA的原因说明
基于资源的伸缩(HPA)存在一定的时延
- 采集时延(分钟级)
- 判断时延(分钟级)
- 伸缩时延(分钟级)
针对部分流量可预测的场景,可通过CronHPA在设定的时间内提前扩容
CronHPA和HPA配合
apiVersion: autoscaling.alibabacloud.com/v1beta1
kind: CronHorizontalPodAutoscaler
metadata:
labels:
controller-tools.k8s.io: "1.0"
name: cronhpa-sample
namespace: default
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: nginx-deployment-basic
excludeDates:
# exclude November 15th
- "* * * 15 11 *"
# exclude every Friday
- "* * * * * 5"
jobs:
- name: "scale-down"
schedule: "30 */1 * * * *"
targetSize: 1
- name: "scale-up"
schedule: "0 */1 * * * *"
targetSize: 3
runOnce: true
更多推荐
已为社区贡献1条内容
所有评论(0)