This repository consists of everything you need to setup simple Kubernetes cluster and demonstrate usage of KEDA mongo scalers. For more samples check https://github.com/kedacore/samples
The included helper provides an easy way to perform both 0 -> n and n -> 0 scalings.
The deployment consists of 4 components:
- Mongo instance
- Dummy pod that will be scaled up and down
- App service that provides some helper methods
kubectl apply -f deployment/Follow the official KEDA guide https://keda.sh/deploy/
To scale the dummy deployment using
Mongo scaler first we have to
deploy the ScaledObjects:
kubectl apply -f keda/mongo-hpa.yamlthis should result again in creation of ScaleObject and an HPA:
kubectl get scaledobjectsNAME SCALETARGETKIND SCALETARGETNAME MIN MAX TRIGGERS AUTHENTICATION READY ACTIVE FALLBACK PAUSED AGE
mongo-scaledobject apps/v1.Deployment dummy-mongo 5 mongodb mongodb-local-trigger True False False Unknown 1dTo scale up we have to insert some values to Mongo database. To do this we can use the helper app:
kubectl exec $(kubectl get pods | grep "server" | cut -f 1 -d " ") -- keda-talk mongo insertto check pods being scaled:
kubectl get podsto scale down, delete all the records:
kubectl exec $(kubectl get pods | grep "server" | cut -f 1 -d " ") -- keda-talk mongo deleteand to debug scaling of the dummy pod:
kubectl logs -n keda -l app=keda-operator