kubernetes集成prometheus 自动扩展 实践

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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,483评论 0 10
  • 桃之夭夭,灼灼其华 其实就是,冷里的美 话说,今日走在一棵老海棠树下,被一树的花开,弄醉了…… 忘记拍的,才是真的好的
    松本静阅读 367评论 0 0
  • 2018年5月15日 星期二 心情:良好 很高兴迈出了第一步来到此次的绒布峰针21天特种兵,我要通过我的努力...
    钜源汽修厂张梅阅读 250评论 0 1
  • 写作已然是当代人必备的技能之一。想象一下这个三陪的写作场景,三个不同风格的男神(梁朝伟、鹿晗、小沈阳)or 女神(...
    大严不馋阅读 482评论 25 12