Hacking on the KEDA project 👩‍💻

If you’re planning to work on the KEDA project(Kubernetes Event-driven Autoscaling), you can the following steps for local development.

From the docs: “KEDA is a Kubernetes-based Event Driven Autoscaler. With KEDA, you can drive the scaling of any container in Kubernetes based on the number of events needing to be processed. KEDA is a single-purpose and lightweight component that can be added into any Kubernetes cluster. KEDA works alongside standard Kubernetes components like the horizontal pod autoscaler and can extend functionality without overwriting or duplication”

Switch to $GOPATH and clone required KEDA projects

cd $GOPATHgit clone https://github.com/kedacore/keda
git clone https://github.com/kedacore/chart

Make required code changes for your feature/bug etc.

If you have an existing installation (this will just delete the KEDA operator Deployment)

helm uninstall -n keda keda

see Troubleshooting (at the end) section for a possible issue

Confirm that there are no KEDA Pods

kubectl get pods -n keda

Switch to keda source directory

cd $GOPATH/src/github.com/kedacore/keda

Set environment variables

//change accordingly using another registry such as quay.io
export IMAGE_REGISTRY=docker.io
//use tag of your choice
export IMAGE_TAG=latest
//use a docker repo of your choice
export IMAGE_REPO=abhirockzz

If you’re using minikube for local Kubernetes dev, doing this will allow you to iterate faster since it will build the Docker images on the minikube host and you won't need to push it to an external Docker repo

eval $(minikube docker-env)
make build

If you want to use an external docker repo

make publish
export $IMAGE_PULL_POLICY=Always

publish will build and docker push

Once build is complete, install KEDA using Helm

I used Helm 3, but Helm 2 is also supported

This will use the Docker image which you just built (with the code changes)

cd ../charts/kedahelm install keda kedacore/keda --set image.keda=$IMAGE_REGISTRY/$IMAGE_REPO/keda:$IMAGE_TAG,image.pullPolicy=$IMAGE_PULL_POLICY --namespace keda

Confirm all is good (wait till status is Running)

kubectl get pods -n keda -w

To check KEDA operator container logs

kubectl logs -f <keda_pod_name> -c keda-operator -n keda


helm uninstall -n keda keda might return this

Error: uninstallation completed with 1 error(s): could not get apiVersions from Kubernetes: could not get apiVersions from Kubernetes: unable to retrieve the complete list of server APIs: external.metrics.k8s.io/v1beta1: the server is currently unable to handle the request

To resolve

kubectl delete apiservice v1beta1.external.metrics.k8s.io

see https://github.com/helm/helm/issues/6361#issuecomment-538220109

Further, if helm install gives you this error

manifest_sorter.go:175: info: skipping unknown hook: "crd-install"
manifest_sorter.go:175: info: skipping unknown hook: "crd-install"
Error: rendered manifests contain a resource that already exists. Unable to continue with install: existing resource conflict: kind: Service, namespace: keda, name: keda-operator

Delete stuff manually

kubectl delete deployment keda-operator -n keda
kubectl delete serviceaccount keda-operator -n keda
kubectl delete clusterrole keda-operator-external-metrics-reader
kubectl delete clusterrole keda-operator
kubectl delete clusterrolebinding keda-operator-hpa-controller-external-metrics
kubectl delete clusterrolebinding keda-operator
kubectl delete clusterrolebinding keda-operator:system:auth-delegator
kubectl delete rolebinding keda-operator-auth-reader -n kube-system
kubectl delete service keda-operator -n keda

Happy hacking! 👩‍💻👨‍💻

Currently working with Kafka, Databases, Azure, Kubernetes and related open source projects | Confluent Community Catalyst (for Kafka)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store