Version: v1.1

自动扩缩容

本小节会介绍,如何为应用部署计划的一个待交付组件,配置自动扩缩容。我们使用运维特征里的 cpuscaler 来完成开发。

字段说明

  1. $ vela show cpuscaler
  2. # Properties
  3. +---------+---------------------------------------------------------------------------------+------+----------+---------+
  4. | NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
  5. +---------+---------------------------------------------------------------------------------+------+----------+---------+
  6. | min | Specify the minimal number of replicas to which the autoscaler can scale down | int | true | 1 |
  7. | max | Specify the maximum number of of replicas to which the autoscaler can scale up | int | true | 10 |
  8. | cpuUtil | Specify the average cpu utilization, for example, 50 means the CPU usage is 50% | int | true | 50 |
  9. +---------+---------------------------------------------------------------------------------+------+----------+---------+

如何使用

  1. # sample.yaml
  2. apiVersion: core.oam.dev/v1beta1
  3. kind: Application
  4. metadata:
  5. name: website
  6. spec:
  7. components:
  8. - name: frontend # This is the component I want to deploy
  9. type: webservice
  10. properties:
  11. image: nginx
  12. traits:
  13. - type: cpuscaler # Automatically scale the component by CPU usage after deployed
  14. properties:
  15. min: 1
  16. max: 10
  17. cpuPercent: 60