mirror of
https://github.com/kubevela/kubevela.git
synced 2026-05-06 01:17:09 +00:00
2.0 KiB
2.0 KiB
Automatically scale workload by cron or resource utilization
Prerequisites
-
KEDA will be automatically deployed during vela installation, so just run the following command.
$ vela install
Scale an application
-
Deploy an application
Run the following command to deploy application
helloworld.$ vela svc deploy frontend -t webservice -a helloworld --image nginx:1.9.2 --port 80 App helloworld deployedCheck the replicas of Deployment
frontendwhich is deployed by workload webservicehelloworldand there is one replica.(TODO: The command below needs to be replaced with
vela showto check the replicas.)$ kubectl get deploy frontend NAME READY UP-TO-DATE AVAILABLE AGE frontend 1/1 1 1 2m52s -
Scale the application by
cron$ vela autoscale helloworld --svc frontend --minReplicas 1 --maxReplicas 4 --replicas 2 --name cron-test --startAt 21:00 --duration 2h --days "Monday, Tuesday" Adding autoscale for app frontend ⠋ Deploying ... ✅ Application Deployed Successfully! - Name: frontend Type: webservice HEALTHY Ready: 1/1 Last Deployment: Created at: 2020-11-03 20:53:50 +0800 CST Updated at: 2020-11-03T21:01:20+08:00 Traits: - autoscale: maxReplicas=4 minReplicas=1 replicas=2 startAt=21:00 timezone=Asia/Shanghai days=Monday, Tuesday name=cron-test type=cron duration=2hThe time is
21:07which is in the active period of the trait which started at21:00and the duration is two hours. Check the replicas of Deploymentfrontendagain, it has been scaled to 2.$ kubectl get deploy NAME READY UP-TO-DATE AVAILABLE AGE frontend 2/2 2 2 8m42sWait after the period ends, the replicas will be one eventually.