You can trigger autoscaling based on CPU usage by adding a CPU usage trigger to your service definition.
services:
app:
image: ghcr.io/acme/website:latest
x-config:
autoscale:
minReplicas: 1
maxReplicas: 100
pollingInterval: 10
triggers:
- type: cpu
metricType: average
metadata:
value: "50"
Properties
The type of trigger to use. Must be cpu
.
metricType
"average" | "sum"
required
The type of metric to use. Must be average
or sum
.
-
When using
sum
, the value is the average across all instances, represented as a percentage of the requested value of
the resource for the pods.
-
When using
average
, the value is the average of the metric across all instances.