keda

by arieotech

Helm chartv0.1.0App 2.16.0Apache-2.0Verified publisher

Production-grade KEDA (Kubernetes Event-Driven Autoscaling) operator chart. Fixes upstream namespace-scoped RBAC (issue #5943). Includes operator, Metrics API Server, and Admission Webhooks. PSA restricted-mode, NetworkPolicy, JSON Schema, SOC2/DPDP defaults, Istio Ambient support. Use keda-crds chart to install CRDs separately (GitOps/ArgoCD safe).

About this chart

arieotech/keda

Production-grade Helm chart for KEDA (Kubernetes Event-Driven Autoscaling) 2.16.0.

Fixes two critical upstream gaps:

Upstream issueArieotech fix
#5943 — Namespace-scoped RBAC brokenoperator.watchNamespace value restricts the operator to specific namespaces
#5575 — No CRD separation chartCompanion keda-crds chart manages CRDs independently

Components

ComponentImagePurpose
keda-operatorghcr.io/kedacore/keda:2.16.0Watches ScaledObjects, manages HPA
keda-metrics-apiserverghcr.io/kedacore/keda-metrics-apiserver:2.16.0Aggregated API for external metrics
keda-admission-webhooksghcr.io/kedacore/keda-admission-webhooks:2.16.0Validates KEDA custom resources

Prerequisites

  • Kubernetes 1.27+
  • Helm 3.12+
  • keda-crds chart installed first (see below)
  • Only one release of this chart per cluster. The Metrics API Server registers a cluster-scoped APIService (v1beta1.external.metrics.k8s.io) with a fixed name — a second release anywhere in the cluster would collide on that same object. This matches upstream KEDA's own single-instance-per-cluster design; it isn't something operator.watchNamespace changes, since that only scopes what the operator watches, not the cluster-scoped resources it registers.

No cert-manager or other TLS provisioning is required — see TLS Certificates for how that's handled.

Quick Start

# Step 1 — Install CRDs separately (GitOps/ArgoCD safe)
helm upgrade --install keda-crds arieotech/keda-crds \
  --namespace keda --create-namespace

# Step 2 — Install the operator
helm upgrade --install keda arieotech/keda \
  --namespace keda --create-namespace \
  --values my-values.yaml

Namespace-Scoped Installation (Arieotech fix for #5943)

To restrict the KEDA operator to specific namespaces:

operator:
  watchNamespace: "production,staging"

With this setting, KEDA only reconciles ScaledObject and ScaledJob resources in the listed namespaces. This is a reconciliation-scope control, not an RBAC boundary — the operator's ClusterRole/ClusterRoleBinding still grant cluster-wide permissions regardless of this setting, since Kubernetes RBAC has no per-namespace restriction mechanism for a ClusterRoleBinding. Use it to avoid the operator acting on ScaledObjects outside its intended scope, not as a tenant-isolation security control.

Values Reference

KeyTypeDefaultDescription
global.imagePullSecretslist[]Image pull secrets applied to all components
operator.image.tagstring"2.16.0"Operator image tag. latest is rejected.
operator.image.digeststring""Pin operator image by digest instead of tag
operator.replicaCountint2Number of operator replicas
operator.resourcesobject100m/128Mi req, 256Mi limitOperator container resources
operator.watchNamespacestring""Comma-separated namespaces to watch. Empty = cluster-wide
operator.logLevelstring"info"Log level: debug, info, error
operator.logEncoderstring"json"Log format: json, console
operator.logTimeFormatstring"rfc3339"Log timestamp encoding
operator.extraEnvlist[]Extra env vars on the operator container
metricsApiServer.replicaCountint2Metrics API Server replicas
metricsApiServer.resourcesobject100m/128Mi req, 256Mi limitMetrics API Server container resources
metricsApiServer.portint6443HTTPS port for the aggregated API
metricsApiServer.logLevelstring"0"glog verbosity level
admissionWebhooks.enabledboolfalseDeploy admission webhooks — TLS is provisioned automatically by the operator's cert rotator, see TLS Certificates; defaults to false pending live CI confirmation of that mechanism
admissionWebhooks.replicaCountint2Admission webhook replicas
admissionWebhooks.resourcesobject50m/64Mi req, 128Mi limitAdmission webhook container resources
admissionWebhooks.portint9443Webhook HTTPS port
serviceAccount.createbooltrueCreate a ServiceAccount
podSecurityContext / securityContextobjectPSA restrictedPod and container security contexts
terminationGracePeriodSecondsint30Grace period for in-flight ScaledObject reconciliations on shutdown
topologySpreadConstraintslisthostname + zoneSpread pods across nodes and AZs
networkPolicy.enabledbooltrueDeploy NetworkPolicy resources
networkPolicy.kubeApiServerCIDRstring""Restrict the API server egress rule to this CIDR (e.g. "10.0.0.1/32"); unset allows HTTPS egress to any destination on 443/6443 — see NetworkPolicy
networkPolicy.extraIngress / extraEgresslist[]Additional rules appended to the default allow-list
pdb.enabledbooltrueDeploy PodDisruptionBudget
pdb.minAvailableint1Minimum available pods per component
autoscaling.enabledboolfalseHPA for the operator Deployment only (uncommon, provided for completeness)
autoscaling.minReplicas / maxReplicasint2 / 5HPA replica bounds
autoscaling.targetCPUUtilizationPercentageint70CPU target; omit to disable the CPU metric
autoscaling.targetMemoryUtilizationPercentageintunsetOptional memory target metric, disabled unless set
metrics.enabledbooltrueExpose Prometheus metrics
metrics.serviceMonitor.enabledboolfalseCreate ServiceMonitor (requires Prometheus Operator)
metrics.prometheusRule.enabledboolfalseCreate PrometheusRule with alert rules
istio.ambient.enabledboolfalseAdd Istio Ambient dataplane labels
istio.ambient.excludedPortslist[]Ports excluded from ztunnel capture
soc2.auditLogging.enabledbooltrueJSON-structured audit logging
dpdp.dataResidency.enabledboolfalseAdd the dpdp.arieotech.com/data-residency-region pod annotation
dpdp.dataResidency.regionstring""Region value for the data-residency annotation, e.g. "in-mumbai"
secretsobject{}Arbitrary Secrets created alongside the chart — see TriggerAuthentication credentials
extraVolumes / extraVolumeMountslist[]Extra volumes mounted on every component
initContainers / sidecarslist[]Extra init/sidecar containers on the operator pod

TriggerAuthentication credentials

secrets creates arbitrary Secret resources named <fullname>-<key>, where <fullname> follows the standard Helm fullname convention (a release named keda produces just keda, not keda-keda). Useful for TriggerAuthentication credentials (Redis passwords, RabbitMQ connection strings, etc.) without hand-rolling a separate Secret manifest:

secrets:
  redis-trigger-auth:
    stringData:
      password: "changeme"
  rabbitmq-trigger-auth:
    type: Opaque
    stringData:
      connectionString: "amqp://user:pass@rabbitmq:5672/vhost"

Reference the generated Secret name (keda-redis-trigger-auth for a release named keda) from your own TriggerAuthentication resources.

TLS Certificates

Unlike many operator charts, you don't need cert-manager or any manual TLS provisioning here. The operator runs with cert rotation enabled by default (--enable-cert-rotation, via open-policy-agent/cert-controller): it generates a CA and cert bundle, stores it in a <fullname>-certs Secret in the release namespace, and automatically patches the resulting caBundle onto both the ValidatingWebhookConfiguration and the APIService. The Metrics API Server and (if enabled) Admission Webhooks mount that same Secret read-only at /certs.

The <fullname>-certs Secret is optional: true on its consumers, since on first install the operator needs a moment to create it. The Metrics API Server and (if enabled) Admission Webhooks Deployments each run a wait-for-certs initContainer that polls for the cert files before starting the main container, so they wait rather than crash-loop during that window — no action needed.

If you run your own PKI and want to bypass this entirely, you'd need to remove --enable-cert-rotation from templates/deployment-operator.yaml and wire your own cert-manager Certificate + caBundle back in — there's currently no values-driven toggle for this, since the chart doesn't yet have a values profile that exercises it.

NetworkPolicy

Every component's egress rules stop at DNS and an "allow the Kubernetes API server" rule on 443/6443 — but that API server rule is port-only by default, not destination-restricted. Kubernetes NetworkPolicy has no generic pod or namespace selector for the API server (it typically runs outside the pod network, e.g. on control-plane nodes or behind a cloud LB), so a rule with only ports and no to: matches any destination on that port. In practice this means HTTPS egress to any host on 443/6443 is allowed out of the box, not just to the API server.

To actually restrict it, set networkPolicy.kubeApiServerCIDR to your API server's IP:

kubectl get endpoints kubernetes -n default -o jsonpath='{.subsets[0].addresses[*].ip}'
networkPolicy:
  kubeApiServerCIDR: "10.0.0.1/32"

Once set, that rule becomes to: [{ ipBlock: { cidr: ... } }] and no longer permits arbitrary HTTPS egress. This isn't set by default because the API server's address is cluster-specific and not knowable ahead of time by a generic chart.

Do not set kubeApiServerCIDR if you rely on this chart's default health checks for the Metrics API Server. Its liveness/readiness probes hit the same HTTPS port as kube-aggregator traffic (there's no separate health port on that binary), and kubeApiServerCIDR restricts ingress on that port too — which also blocks kubelet's probe traffic, since kubelet has no selectable identity NetworkPolicy can carve an exception out for. There's no NetworkPolicy-only way to allow both "the API server from a specific CIDR" and "kubelet from the node" on the same port at once.

Deploying with ArgoCD

keda-crds must be installed (and healthy) before keda, since the operator and webhooks depend on the CRDs existing at startup. When managing both charts as ArgoCD Application resources, set sync waves so CRDs land first:

# keda-crds Application
metadata:
  annotations:
    argocd.argoproj.io/sync-wave: "-1"
---
# keda Application
metadata:
  annotations:
    argocd.argoproj.io/sync-wave: "0"

If using an ApplicationSet or a single App-of-Apps, apply the same sync-wave annotations to the generated Applications. keda-crds ships helm.sh/resource-policy: keep on every CRD, so ArgoCD pruning or helm uninstall never deletes CRDs (and the ScaledObjects/ScaledJobs they back) by accident.

Troubleshooting

Operator crash-looping with no matches for kind "ScaledObject": The keda-crds chart was not installed, or was installed after keda. Install/sync keda-crds first and confirm with kubectl get crd | grep keda.sh.

Admission webhook (or operator, or Metrics API Server) pods stuck CrashLoopBackOff on startup with a cert-related error: The <fullname>-certs Secret the operator's cert rotator manages doesn't exist yet — normal briefly on first install (see TLS Certificates); kubelet retries automatically. If it persists, check the operator's own logs first — it owns creating this Secret. You can temporarily set admissionWebhooks.enabled: false to unblock ScaledObject changes while investigating.

HPA not scaling despite ScaledObject present: Confirm the metrics API server is registered: kubectl get apiservice v1beta1.external.metrics.k8s.io. If it shows False under AVAILABLE, check metricsApiServer pod logs and that auth-delegator/extension-apiserver-authentication-reader RoleBindings exist.

operator.watchNamespace set but scaling still happens everywhere: The value is comma-separated with no spaces (e.g. "production,staging", not "production, staging"). Restart the operator pods after changing this value — it is read at process start.

NetworkPolicy blocking scaler connectivity: networkPolicy.enabled=true ships a default-deny egress policy for everything except DNS and HTTPS to 443/6443 (see NetworkPolicy for why that HTTPS rule is broader than "API server only" by default). For non-HTTPS trigger sources (e.g. plain RabbitMQ/Kafka ports), add a rule via networkPolicy.extraEgress.

Production Checklist

  • [ ] keda-crds chart installed and version matches operator.image.tag
  • [ ] operator.watchNamespace set for multi-tenant clusters
  • [ ] networkPolicy.enabled=true (default)
  • [ ] pdb.enabled=true (default)
  • [ ] metrics.serviceMonitor.enabled=true if using Prometheus Operator
  • [ ] metrics.prometheusRule.enabled=true for alert rules
  • [ ] admissionWebhooks.enabled=true (default false) once you've confirmed the operator's cert rotator is provisioning <fullname>-certs correctly — see TLS Certificates
  • [ ] soc2.auditLogging.enabled=true (default) for audit log compliance
  • [ ] Image digest pinning: set operator.image.digest / metricsApiServer.image.digest / admissionWebhooks.image.digest
  • [ ] replicaCount >= 2 for all components (default)

SOC2 Compliance

Structured JSON audit logging is enabled by

Deploy keda with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has keda on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartkeda is pinned at v0.1.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply