In the following tutorial, you will learn to add KEDA as a new autoscaling trait to your KubeVela based platform.
KEDA is a Kubernetes-based Event Driven Autoscaler. With KEDA, you can drive the scaling of any container based on resource metrics or the number of events needing to be processed.
Install the KEDA controller into your K8s system.
To register KEDA as a new capability (i.e. trait) in KubeVela, the only thing needed is to create an
TraitDefinition object for it.
A full example can be found in this keda.yaml. Several highlights are list below.
We use label
definition.oam.dev/description to add one line description for this trait.
It will be shown in helper commands such as
$ vela traits.
This is how you claim and register KEDA
ScaledObject's API resource (
scaledobjects.keda.sh) as a trait definition.
A trait can be attached to specified workload types or all (i.e.
"*" means your trait can work with any workload type).
For the case of KEAD, we will only allow user to attach it to Kubernetes workload type. So we claim it as below:
In this step, we will define the schematic of KEDA based autoscaling trait, i.e. we will create abstraction for KEDA
ScaledObject with simplified primitives, so end users of this platform don't really need to know what is KEDA at all.
This is a CUE based template which only exposes
value as trait properties for user to set.
Please check the Defining Trait with CUE section for more details regarding to CUE templating.
As long as the definition file is ready, you just need to apply it to Kubernetes.
And the new trait will immediately become available for end users to use in