Terraform module deploys KEDA (Kubernetes Event-driven Autoscaling) into a Kubernetes cluster. KEDA allows for fine-grained autoscaling (including to/from zero) for event-driven Kubernetes workloads. KEDA serves as a Kubernetes Metrics Server and allows users to define autoscaling rules using a dedicated Kubernetes custom resource definition.

The module simplifies the deployment and configuration of KEDA, enabling event-driven autoscaling for your Kubernetes workloads.

Log in to Corewide IaC registry

Once you have a Corewide Solutions Portal account, this one-time action will use your browser session to retrieve credentials:

 shellterraform login solutions.corewide.com
Provision instructions

Initialize mandatory providers:

Copy and paste into your Terraform configuration and insert the variables:

 hclmodule "tf_k8s_keda" {
  source  = "solutions.corewide.com/kubernetes/tf-k8s-keda/helm"
  version = "~> 2.1.0"

  # specify module inputs here or try one of the examples below
  ...
}

Initialize the setup:

 shellterraform init
Define update strategy

Corewide DevOps team strictly follows Semantic Versioning Specification to provide our clients with products that have predictable upgrades between versions. We recommend pinning patch versions of our modules using pessimistic constraint operator (~>) to prevent breaking changes during upgrades.

To get new features during the upgrades (without breaking compatibility), use ~> 2.1 and run terraform init -upgrade

For the safest setup, use strict pinning with version = "2.1.0"

Event-driven Autoscaling for Kubernetes

Event-driven Autoscaling for Kubernetes deployed from Helm chart
Module
35% off
€410
€270
TOTAL €270
BUY
v2.1.0 released 2 months ago
New version approx. every 29 weeks

Terraform module deploys KEDA (Kubernetes Event-driven Autoscaling) into a Kubernetes cluster. KEDA allows for fine-grained autoscaling (including to/from zero) for event-driven Kubernetes workloads. KEDA serves as a Kubernetes Metrics Server and allows users to define autoscaling rules using a dedicated Kubernetes custom resource definition.

The module simplifies the deployment and configuration of KEDA, enabling event-driven autoscaling for your Kubernetes workloads.

Minimal setup with default parameters:

 hclmodule "keda" {
  source  = "solutions.corewide.com/kubernetes/tf-k8s-keda/helm"
  version = "~> 2.1"
}

Deploy KEDA operator and metrics server with 2 replicas each, set pod annotation to configure with the AWS IAM role, enable Prometheus monitoring, and restrict KEDA to watch only specific namespaces to scale their workloads. KEDA resources are placed on a specific node with debug logging enabled:

 hclmodule "keda" {
  source  = "solutions.corewide.com/kubernetes/tf-k8s-keda/helm"
  version = "~> 2.1"

  operator_replicas       = 2
  metrics_server_replicas = 2

  watch_namespaces = [
    "prod",
    "dev",
  ]

  pod_annotations = {
    "iam.amazonaws.com/role" = "arn:aws:iam::123456789012:role/keda-operator"
  }

  prometheus = {
    create_service_monitor = true
  }

  node_selector = {
    "node-type" = "worker"
  }

  custom_values = {
    logging = {
      operator = {
        level = "debug"
      }
    }
  }
}
Variable Description Type Default Required Sensitive
name_prefix Naming prefix for all the resources created by the module string yes no
app_version KEDA version to deploy (image tag, compatible versions are 2.20.0 and newer) string 2.20.2 no no
chart_version KEDA Helm chart version to deploy (compatible versions are 2.20.0 and newer) string 2.20.2 no no
create_namespace Indicates whether to create a dedicated namespace for KEDA deployment bool true no no
custom_values KEDA Helm chart custom values any {} no no
http_addon KEDA HTTP addon parameters: object {} no no
http_addon.app_version KEDA HTTP addon server version string 0.15.0 no no
http_addon.chart_version KEDA HTTP addon chart version string 0.15.0 no no
http_addon.custom_values KEDA HTTP addon Helm chart custom values any {} no no
http_addon.enabled Toggle KEDA HTTP addon installation bool false no no
http_addon.node_selector Node selector for the KEDA HTTP addon components. By default, the same as in KEDA map(string) {} no no
http_addon.watch_namespaces List of namespaces KEDA HTTP addon should watch. Empty means watch all namespaces. By default, the same as in KEDA list(string) [] no no
metrics_server_replicas Number of replicas for the KEDA metrics API server number 2 no no
namespace The namespace to install KEDA into string keda no no
node_selector Node selector for KEDA components map(string) {} no no
operator_replicas Number of replicas for the KEDA operator number 2 no no
pod_annotations Annotations to add to KEDA pods (operator and metrics API server) map(string) {} no no
prometheus KEDA Prometheus integration configuration parameters: object {} no no
prometheus.create_pod_monitor Indicates if a PodMonitor should be created for Prometheus monitoring bool false no no
prometheus.create_service_monitor Indicates if a ServiceMonitor should be created for Prometheus monitoring bool false no no
service_account KEDA operator ServiceAccount configuration parameters: object {} no no
service_account.annotations KEDA operator service account annotations map(string) {} no no
service_account.create Indicates creation service account for KEDA operator bool true no no
service_account.name KEDA operator service account name string keda-operator no no
watch_namespaces List of namespaces KEDA should watch. Empty means watch all namespaces list(string) [] no no
Output Description Type Sensitive
namespace The namespace where KEDA is installed resource no
service_account_name The name of the ServiceAccount used by KEDA operator attribute no
Dependency Version Kind
terraform >= 1.3 CLI
hashicorp/helm ~> 3.1 provider
hashicorp/kubernetes ~> 3.0 provider

These components are included as is under the terms of their corresponding licenses.

Component License
KEDA Apache-2.0
KEDA Helm charts Apache-2.0
KEDA HTTP addon Apache-2.0

Not sure where to start?
Let's find your perfect match.