I am Susil

KEDA scales kubernetes containers based on events from various external source / internal metrics. Kubernetes supports horizontal scaling using HPA (Horizontal Pod Scaler) in a replication controller, replicaset, stateful set or deployment based on memory or CPU utilization. HPA is a Kubernetes API and controller periodically adjusting number of replicas.

Kubernetes supports custom metrics to scale pods based on external metric apart from CPU and memory. KEDA works with HPA and extends functionality without duplicating.

 

                             keda-arch

Event-driven It scales resources based on events occurring inside cluster or from any external resource.

Scalers It provides out-of-the-box scalers which are vendor agnostic and supports multitude of software at different application levels. Below are few of the scalers, entire list is available here

  • Apache Kafka
  • AWS CloudWatch
  • Azure Pipelines
  • MongoDB
  • Prometheus

Workloads It supports scaling different types of resources Deployment, CronJob, Pods etc

Most of the scaler has two parts to scale resources

  1. Trigger Authentication – Scaler might require authentication to listen for events. Configuration for authentication will be stored individually objects to be scaled and can be reused across objects for storing credentials. It has ability to retrieve information from k8s secrets and environment variables.
  2. Scaled Object – This custom resource contains details about the type of scaler being used, min and max replica count, authentication reference (used details from trigger authentication) and most importantly object being scaled (deployment, pod, job)

Installation

Installing KEDA using HELM is very simple

  1. Add Helm repo
    helm repo add kedacore https://kedacore.github.io/charts
  2. Update Helm repo
    helm repo update
  3. Install keda Helm chart
    kubectl create namespace keda
    helm install keda kedacore/keda --version 1.4.2 --namespace keda

Helm chart installs keda-operator and metrics-apiserver pods

$ kubectl get po -n keda
NAME                                               READY   STATUS    RESTARTS   AGE
keda-operator-7fc5699d47-ng7rk                     1/1     Running   0          75s
keda-operator-metrics-apiserver-57fc85685f-zqnzr   1/1     Running   0          75s

$ kubectl get apiservices v1beta1.external.metrics.k8s.io
NAME                              SERVICE                                AVAILABLE   AGE
v1beta1.external.metrics.k8s.io   keda/keda-operator-metrics-apiserver   True 

We have installed KEDA operator and custom metrics server in our cluster.

In next blog we will see installing custom scaler to auto-scale Azure Devops build agents.


Comment Section

Comments are closed.