cloud-native-event-driven-scaling
Use when the user asks about KEDA, ScaledObject, ScaledJob, TriggerAuthentication, scale to zero, scaling pods on queue length, Kafka consumer lag or SQS…
от j4flmao★ 47 звёзд на GitHub
Установить cloud-native-event-driven-scaling в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Event-Driven Scaling with KEDA
Purpose
CPU-based HPA reacts late to queue backlogs and cannot scale from zero. KEDA feeds event-source metrics to the HPA and handles 0↔1 activation itself, so consumers scale with work waiting rather than with CPU after the fact.
Agent Protocol
Trigger
"keda", "scale to zero", "ScaledObject", "ScaledJob", "scale on queue length", "kafka consumer autoscaling", "sqs scaling", "event driven autoscaling", "TriggerAuthentication".
Input Context
- Event source and auth model (IRSA/EKS Pod Identity, Workload Identity, secrets).
- Per-pod throughput (messages/s) and acceptable backlog drain time.
- Message processing duration (seconds vs hours).
Output Artifact
ScaledObject/ScaledJob + TriggerAuthentication YAML. No file unless requested.
Response Format
Resource: {ScaledObject|ScaledJob} (why)
Trigger: {type} target={value} activation={value}
Replicas: min={n} max={n} (max bounded by {partitions|downstream limit})
Flapping control: {cooldownPeriod, HPA behavior}
Auth: {TriggerAuthentication / ClusterTriggerAuthentication}
Completion Criteria
- Target value derived from per-pod throughput, not guessed.
-
maxReplicaCountbounded by partitions or downstream capacity. - Long-running work uses ScaledJob or graceful termination.
How KEDA Works
- keda-operator: watches
ScaledObjects, polls scalers everypollingInterval(default 30 s), creates/owns an HPA, and performs activation (scales 0→1 when the metric exceedsactivationThreshold/activation*value, and 1→0 aftercooldownPeriod, default 300 s, with no activity). - keda-operator-metrics-apiserver: implements the Kubernetes External Metrics API (
external.metrics.k8s.io); the HPA queries it for 1↔N scaling. - KEDA does not replace the HPA — scaling between 1 and N is the regular HPA algorithm:
desired = ceil(current × currentMetric / target); forAverageValueexternal metrics this is effectivelyceil(totalMetric / target). - Only one external metrics server can be registered per cluster; KEDA conflicts with other adapters (e.g. prometheus-adapter for external metrics).
Sizing the Target
target per pod = per-pod throughput (msg/s) × acceptable drain time (s)
Example: a pod processes 20 msg/s, backlog must drain within 30 s → queueLength: "600". A backlog of 6,000 → 10 replicas.
ScaledObject — AWS SQS
apiVersion: keda.sh/v1alpha1
kind: TriggerAuthentication
metadata:
name: aws-pod-identity
namespace: orders
spec:
podIdentity:
provider: aws # uses the workload's IRSA / EKS Pod Identity role
---
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: order-worker
namespace: orders
spec:
scaleTargetRef:
name: order-worker # Deployment
minReplicaCount: 0
maxReplicaCount: 40
pollingInterval: 15
cooldownPeriod: 300 # only used for scaling to zero
advanced:
horizontalPodAutoscalerConfig:
behavior: # standard autoscaling/v2 behavior for 1..N
scaleDown:
stabilizationWindowSeconds: 300
policies:
- type: Percent
value: 50
periodSeconds: 60
triggers:
- type: aws-sqs-queue
authenticationRef:
name: aws-pod-identity
metadata:
queueURL: https://sqs.eu-west-1.amazonaws.com/123456789012/orders
awsRegion: eu-west-1
queueLength: "600"
activationQueueLength: "0"
identityOwner: operator is the alternative when the KEDA operator's own role should read the queue.
Kafka Consumers
triggers:
- type: kafka
metadata:
bootstrapServers: kafka.kafka.svc:9092
consumerGroup: payments
topic: payments
lagThreshold: "500"
activationLagThreshold: "10"
offsetResetPolicy: latest
- Replicas beyond the partition count sit idle (one partition → at most one consumer in the group). The Kafka scaler caps replicas at the partition count by default (
allowIdleConsumers: "false");limitToPartitionsWithLag: "true"caps further to partitions that actually have lag. - Rebalances pause consumption; aggressive scaling causes rebalance storms → use scale-down stabilization and cooperative-sticky assignment in clients.
ScaledJob for Long-Running Work
For multi-minute/hour tasks (video encoding, ML batch) a Deployment scale-down can kill in-flight work. ScaledJob creates one Kubernetes Job per unit of work instead:
apiVersion: keda.sh/v1alpha1
kind: ScaledJob
metadata:
name: transcoder
spec:
jobTargetRef:
backoffLimit: 2
template:
spec:
restartPolicy: Never
containers:
- name: transcoder
image: registry.example.com/transcoder:1.8.2
pollingInterval: 10
maxReplicaCount: 20
successfulJobsHistoryLimit: 5
failedJobsHistoryLimit: 5
scalingStrategy:
strategy: accurate # accounts for pending
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- references/kafka-scaler-internals.md
- references/keda-architecture.md
- references/scale-to-zero-mechanics.md
FAQ
Что делает скилл cloud-native-event-driven-scaling?
Use when the user asks about KEDA, ScaledObject, ScaledJob, TriggerAuthentication, scale to zero, scaling pods on queue length, Kafka consumer lag or SQS depth autoscaling on Kubernetes. Produces KEDA configs with flapping control and long-running job handling. Not for CPU/memory HPA, VPA or node autoscaling (use devops-kubernetes-autoscaling).
Как установить скилл cloud-native-event-driven-scaling?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл cloud-native-event-driven-scaling запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
ci-review
AnthropicThe scan that the plugin's GitHub Action runs.
azure-static-web-apps
GitHubHelps create, configure, and deploy Azure Static Web Apps using the SWA CLI. Use when deploying static sites to Azure, setting up SWA local development…
ai-ready
GitHubMake any repo AI-ready — analyzes your codebase and generates AGENTS.md, copilot-instructions.md, CI workflows, issue templates, and more. Mines your PR…
aws-cdk-python-setup
GitHubSetup and initialization guide for developing AWS CDK (Cloud Development Kit) applications in Python. This skill enables users to configure environment…