美文网首页
弹性伸缩

弹性伸缩

作者: Robin92 | 来源:发表于2022-04-23 23:34 被阅读0次

弹性伸缩(Horizontal Pod Autoscaler,HPA)的操作对象是 RS 和 RC 或 Deployment 对应的 Pod。工作原理:监控CPU使用率,当达到阈值时做出增减实例数量的决策。

...
# spec.containers[i].resources
resources:
  limits:
    cpu: 100m
    memory: 50Mi
  requests
    cpu: 100m
    memory: 50Mi

命令:

kubectl autoscale replicationcontroller myweb --max=8 --min=1 --cpu-percent=10 
# myweb 最大 8 个 Pod,最小 1 个 Pod,当 cpu 百分比达到 10% 时出发 HPA

kubectl get all 可以看到 hpa/myweb 资源。通过压测,查看 CPU 占用以及扩展伸缩情况。

待实践及截图

相关文章

网友评论

      本文标题:弹性伸缩

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