QuickStart with KEDA
Install KEDA using Helm
Deploying KEDA with Helm is very simple:
-
Add Helm repo
helm repo add kedacore https://kedacore.github.io/charts
-
Update Helm repo
helm repo update
-
Install
keda
Helm chart
kubectl create namespace keda
helm install keda kedacore/keda --namespace keda
You can find another install way in official documentatin
Create PredictKube Credentials secret
API_KEY="<change-me>"
kubectl create secret generic predictkube-secrets --from-literal=apiKey=${API_KEY}
Configure Predict Autoscaling
tee scaleobject.yaml << EOF
apiVersion: keda.sh/v1alpha1
kind: TriggerAuthentication
metadata:
name: keda-trigger-auth-predictkube-secret
spec:
secretTargetRef:
- parameter: apiKey
name: predictkube-secrets
key: apiKey
---
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: example-app-scaler
spec:
scaleTargetRef:
name: example-app
pollingInterval: 60
cooldownPeriod: 300
minReplicaCount: 3
maxReplicaCount: 50
triggers:
- type: predictkube
metadata:
predictHorizon: "2h"
historyTimeWindow: "7d" # We recomend to use minimum 7-14 days time window as historical data
prometheusAddress: http://kube-prometheus-stack-prometheus.monitoring:9090
query: sum(irate(http_requests_total{pod=~"example-app-.*"}[2m]))
queryStep: "2m" # Note: query step duration for range prometheus queries
threshold: '2000' # Value to start scaling for
authenticationRef:
name: keda-trigger-auth-predictkube-secret
EOF
Get stats
Now you can look how scaling works using kubectl get hpa
command