I found a resource that resolved my problem
Deployment example:
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: keda-scale
namespace: test-environment
spec:
scaleTargetRef:
apiVersion: privatecloud.mendix.com/v1alpha1 # Optional. Default: apps/v1
kind: MendixApp # Optional. Default: Deployment
name: ynagnond # Mandatory. Must be in the same namespace as the ScaledObject
envSourceContainerName: mendix # Optional. Default: .spec.template.spec.containers[0]
pollingInterval: 30 # Optional. Default: 30 seconds
cooldownPeriod: 300 # Optional. Default: 300 seconds
idleReplicaCount: 0 # Optional. Default: ignored, must be less than minReplicaCount
minReplicaCount: 1 # Optional. Default: 0
maxReplicaCount: 10 # Optional. Default: 100
fallback: # Optional. Section to specify fallback options
failureThreshold: 3 # Mandatory if fallback section is included
replicas: 6 # Mandatory if fallback section is included
advanced: # Optional. Section to specify advanced options
restoreToOriginalReplicaCount: true # Optional. Default: false
horizontalPodAutoscalerConfig: # Optional. Section to specify HPA related options
behavior:
scaleDown:
stabilizationWindowSeconds: 30
policies:
- type: Percent
value: 100
periodSeconds: 15
scaleUp:
stabilizationWindowSeconds: 0
policies:
- type: Percent
value: 100
periodSeconds: 15
- type: Pods
value: 4
periodSeconds: 15
selectPolicy: Max
triggers:
- type: cpu
metadata:
type: Utilization
value: "80"
- type: memory
metadata:
type: Utilization
value: "80"
You can auto scale the mendixapp custom resource (documentation):
kubectl -n {namespace} autoscale mendixapp {envname} --cpu-percent=50 --min=1 --max=10
where {namespace} is your namespace name, and {envname} your mendixapp metadata name.