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.

Event-driven Autoscaling for Kubernetes

Event-driven Autoscaling for Kubernetes deployed from Helm chart
$300
BUY
104
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 = "~> 1.0.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 ~> 1.0 and run terraform init -upgrade

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

v1.0.0 released 6 months ago

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 = "~> 1.0"

  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"
  }
}

Minimal setup with default parameters:

 hclmodule "keda" {
  source  = "solutions.corewide.com/kubernetes/tf-k8s-keda/helm"
  version = "~> 1.0"
}
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) string 2.15.0 no no
chart_version KEDA Helm chart version to deploy string 2.15.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 map(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 ServiceAccount configuration parameters: object {} no no
service_account.annotations KEDA service account annotations map(string) {} no no
service_account.create Indicates creation service account for KEDA bool true no no
service_account.name KEDA 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 attribute no
Dependency Version Kind
terraform >= 1.3 CLI
hashicorp/helm ~> 2.5 provider
hashicorp/kubernetes ~> 2.9 provider

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