[//]: # (Confidential document)
[//]: # (01/05/2025)
[//]: # (v 1.7.3)

# Kubernetes  labs v1.7.3
## Scalability :  Keda

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. With KEDA you can explicitly map the apps you want to use event-driven scale, with other apps continuing to function. This makes KEDA a flexible and safe option to run alongside any number of any other Kubernetes applications or frameworks.


## Lab1: RabbitMQ Queue

 - Add Keda Helm repo & Install Keda Helm chart
 - Add Bitnami Helm repo & Install RabbitMQ Helm chart
 - Clone sample go rabbitmq project
 - Deploy a RabbitMQ consumer
 - Publish messages to the queue

```
helm repo add kedacore https://kedacore.github.io/charts
helm repo update
kubectl create namespace keda
helm install keda kedacore/keda --namespace keda

helm repo add bitnami https://charts.bitnami.com/bitnami
helm install rabbitmq --set auth.username=user --set auth.password=PASSWORD bitnami/rabbitmq --wait
kubectl get po


git clone https://github.com/kedacore/sample-go-rabbitmq
cd sample-go-rabbitmq
kubectl apply -f deploy/deploy-consumer.yaml
kubectl get deploy

kubectl apply -f deploy/deploy-publisher-job.yaml
kubectl get hpa
```

## Clean up

```shell
kubectl delete job rabbitmq-publish
kubectl delete ScaledObject rabbitmq-consumer
kubectl delete deploy rabbitmq-consumer
helm delete rabbitmq
helm delete keda -n keda
```