kubernetes集成prometheus 自动扩展 实践

2018-05-30  本文已影响0人  getsu

2018/07/25 更新

1.11版本出于安全原因kubelet的--read-only-port被禁用,需要手动添加。

官方link

  1. 环境: kubernetes v1.10.2, Weave, Prometheus v2.2.1

  2. 需要kube-controller-manager中加上--horizontal-pod-autoscaler-use-rest-clients=true

  3. 集成prometheus使用了https://github.com/stefanprodan/k8s-prom-hpa

    • kubectl create -f ./metrics-server
  4. 创建HPA命令例kubectl autoscale deploy qrcode-service --min=1 --max=10 --cpu-percent=20

后使用wrk进行压力测试,几分钟后发现qrcode-service自动扩展了。这里直接贴官方文档:

Starting from v1.6, a cluster operator can mitigate this problem by tuning the global HPA settings exposed as flags for the kube-controller-manager component:

--horizontal-pod-autoscaler-downscale-delay: The value for this option is a duration that specifies how long the autoscaler has to wait before another downscale operation can be performed after the current one has completed. The default value is 5 minutes (5m0s).

--horizontal-pod-autoscaler-upscale-delay: The value for this option is a duration that specifies how long the autoscaler has to wait before another upscale operation can be performed after the current one has completed. The default value is 3 minutes (3m0s).

上一篇 下一篇

猜你喜欢

热点阅读