﻿# Install Keda

> [HTML Version](install-keda.html)

KEDA is an event-driven autoscaler that complements the functionality of BRIX applications with advanced scaling capabilities. With KEDA, you can manage the scaling of any container in Kubernetes based on the number of events that need to be processed.

The installation consists of three steps:

1. [Download the Helm chart and configuration file](#download-helm-chart-and-config-file).

2. [Fill out the configuration file](#fill-config-file).

3. [Install the KEDA chart using Helm in the Kubernetes cluster](#instal-keda-chart).

## Step 1: Download the Helm chart and configuration file

To install via the internet, obtain the configuration file \[OBJECT\] by executing the command:

````
helm repo add brix365 https://charts.brix365.com  
helm repo update  
helm show values brix365/keda > values-keda.yaml

````
Getting the configuration file for installation in a closed network without internet access

1. On a computer with internet access, download the BRIX images and upload them to the local image registry by executing the following command:

````
helm repo add brix365 https://charts.brix365.com  
helm repo update  
helm pull brix365/keda

````
For more details, see [Download BRIX images](downloadin-images-elma365.md).

2. Copy the downloaded chart archive \[OBJECT\] to the server where the installation will be carried out.

3. Unpack this chart and copy the default configuration file \[OBJECT\] to \[OBJECT\]: 

````
tar -xf keda-X.Y.Z.tgz  
cp keda/values.yaml values-keda.yaml
````

## ````
Step 2: Fill out the configuration file

Fill out the configuration file \[OBJECT\] for the KEDA service installation.

If needed, specify the \[OBJECT\] that KEDA should monitor (by default, KEDA monitors all the \[OBJECT\]). To do that, in the \[OBJECT\] parameter, specify the \[OBJECT\] where the application is installed.

If high availability is required, set the number of replicas to **3** in parameters \[OBJECT\] and \[OBJECT\].

````
\# keda settings  
keda:  
  # number of replicas for high availability  
  operator:  
    replicaCount: 1  
  metricsServer:  
    replicaCount: 1  
  # namespace that KEDA should monitor  
  watchNamespace:  
    ""  
  # install crds  
  crds:  
    install: true  
...

````
Filling out the connection parameters to a private registry for installation in a closed loop without internet access

  
To connect to a private registry, you need to:

1. Download BRIX images and upload them to the local image registry. For more details, see [Download BRIX images](downloadin-images-elma365.md).

2. Set the address and path in the parameters \[OBJECT\] and \[OBJECT\].

3. Specify the name of the secret with access rights to the private registry in the parameter \[OBJECT\]. The secret must be created manually and encrypted in Base64.

````
\# keda settings  
keda:  
...  
  # Connection parameters to a private registry  
  image:  
    # address and path for the private registry  
    keda:  
      repository: registry.example.com/kedacore/keda  
    metricsApiServer:      
      repository: registry.example.com/kedacore/keda-metrics-apiserver  
  # The secret with access rights to the private registry must be created manually, encrypted in Base64  
  imagePullSecrets:  
    - name: myRegistryKeySecretName

````
Where the repository** **format is as follows:

- Address is \[OBJECT\].

- Path is \[OBJECT\] (for \[OBJECT\] — \[OBJECT\]).

## Step 3: Install the KEDA chart using Helm in the Kubernetes cluster

Before installing the keda chart in a Deckhouse cluster, perform the following actions:

1. Disable the \[OBJECT\] module:

````
kubectl -ti -n d8-system exec svc/deckhouse-leader -c deckhouse -- deckhouse-controller module disable prometheus-metrics-adapter

````
2. Install \[OBJECT\]:

````
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml

````
3. If Kubernetes HPA is already used in your company, disable or delete it in the \[OBJECT\]. To delete it, execute the following command:

````
kubectl delete hpa --all -n brix365

````
Run the installation of the keda chart in a separate \[OBJECT\], for example, \[OBJECT\]. The namespace will be created during installation if it was not created earlier.

For online installation:

````
helm upgrade --install keda brix365/keda -f values-keda.yaml -n keda --create-namespace 

````
For offline installation without internet access, navigate to the directory with the downloaded chart and execute the command:

````
helm upgrade --install keda ./keda -f values-keda.yaml -n keda --create-namespace

````
Please note that:

1. The installation of the KEDA add-on component does not automatically enable support for advanced autoscaling on the BRIX application side.

2. After installation, do not forget to change the BRIX application settings and configure advanced autoscaling on the BRIX application side.

Read more about enabling advanced scaling of services on the BRIX application side in [Enable service autoscaling in BRIX On-Premises](autoscaling-service-enterprise.md).

## Delete the KEDA chart using Helm in the Kubernetes cluster

````
Начало внимание

````
Before removing the KEDA add-on component, reconfigure the BRIX application to use the HPA autoscaling tool.

````
Конец внимание

````
To delete the KEDA chart in \[OBJECT\], execute the command:

````
helm uninstall keda -n keda
````