美文网首页
kubernetes集成prometheus 自动扩展 实践

kubernetes集成prometheus 自动扩展 实践

作者: getsu | 来源:发表于2018-05-30 19:21 被阅读0次

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).

相关文章

网友评论

      本文标题:kubernetes集成prometheus 自动扩展 实践

      本文链接:https://www.haomeiwen.com/subject/kypxsftx.html