Version: v1.0

Manual Scaling

The scaler trait allows you to scale your component instance manually.

  1. $ kubectl vela show scaler
  2. # Properties
  3. +----------+--------------------------------+------+----------+---------+
  4. | NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
  5. +----------+--------------------------------+------+----------+---------+
  6. | replicas | Specify replicas of workload | int | true | 1 |
  7. +----------+--------------------------------+------+----------+---------+

Declare an application with scaler trait.

  1. # sample-manual.yaml
  2. apiVersion: core.oam.dev/v1beta1
  3. kind: Application
  4. metadata:
  5. name: website
  6. spec:
  7. components:
  8. - name: frontend
  9. type: webservice
  10. properties:
  11. image: nginx
  12. traits:
  13. - type: scaler
  14. properties:
  15. replicas: 2
  16. - type: sidecar
  17. properties:
  18. name: "sidecar-test"
  19. image: "fluentd"
  20. - name: backend
  21. type: worker
  22. properties:
  23. image: busybox
  24. cmd:
  25. - sleep
  26. - '1000'

Apply the sample application:

  1. $ kubectl apply -f https://raw.githubusercontent.com/oam-dev/kubevela/master/docs/examples/enduser/sample-manual.yaml
  2. application.core.oam.dev/website configured

In runtime cluster, you can see the underlying deployment of frontend component has 2 replicas now.

  1. $ kubectl get deploy -l app.oam.dev/name=website
  2. NAME READY UP-TO-DATE AVAILABLE AGE
  3. backend 1/1 1 1 19h
  4. frontend 2/2 2 2 19h

To scale up or scale down, you just need to modify the replicas field of scaler trait and re-apply the YAML.