Skip to content

karthikeyanVK/mongo-keda-scaler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KEDA example

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.

Create cluster

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/

Install KEDA

Follow the official KEDA guide https://keda.sh/deploy/

Mongo example

To scale the dummy deployment using Mongo scaler first we have to deploy the ScaledObjects:

kubectl apply -f keda/mongo-hpa.yaml

this should result again in creation of ScaleObject and an HPA:

kubectl get scaledobjects
NAME                 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   1d

To 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 insert

to check pods being scaled:

kubectl get pods

to scale down, delete all the records:

kubectl exec $(kubectl get pods | grep "server" | cut -f 1 -d " ") -- keda-talk mongo delete

and to debug scaling of the dummy pod:

kubectl logs -n keda -l app=keda-operator

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published