Version: v1.0
Manual Scaling
The scaler trait allows you to scale your component instance manually.
$ kubectl vela show scaler# Properties+----------+--------------------------------+------+----------+---------+| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |+----------+--------------------------------+------+----------+---------+| replicas | Specify replicas of workload | int | true | 1 |+----------+--------------------------------+------+----------+---------+
Declare an application with scaler trait.
# sample-manual.yamlapiVersion: core.oam.dev/v1beta1kind: Applicationmetadata:name: websitespec:components:- name: frontendtype: webserviceproperties:image: nginxtraits:- type: scalerproperties:replicas: 2- type: sidecarproperties:name: "sidecar-test"image: "fluentd"- name: backendtype: workerproperties:image: busyboxcmd:- sleep- '1000'
Apply the sample application:
$ kubectl apply -f https://raw.githubusercontent.com/oam-dev/kubevela/master/docs/examples/enduser/sample-manual.yamlapplication.core.oam.dev/website configured
In runtime cluster, you can see the underlying deployment of frontend component has 2 replicas now.
$ kubectl get deploy -l app.oam.dev/name=websiteNAME READY UP-TO-DATE AVAILABLE AGEbackend 1/1 1 1 19hfrontend 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.