k8s-autoscaling

Configure Kubernetes autoscaling with HPA, VPA, and KEDA. Use for horizontal/vertical pod autoscaling, event-driven scaling, and capacity management.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "k8s-autoscaling" with this command: npx skills add rohitg00/k8-autoscaling

Kubernetes Autoscaling

Comprehensive autoscaling using HPA, VPA, and KEDA with kubectl-mcp-server tools.

Quick Reference

HPA (Horizontal Pod Autoscaler)

Basic CPU-based scaling:

apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: my-app-hpa
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: my-app
  minReplicas: 2
  maxReplicas: 10
  metrics:
  - type: Resource
    resource:
      name: cpu
      target:
        type: Utilization
        averageUtilization: 70

Apply and verify:

apply_manifest(hpa_yaml, namespace)
get_hpa(namespace)

VPA (Vertical Pod Autoscaler)

Right-size resource requests:

apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
  name: my-app-vpa
spec:
  targetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: my-app
  updatePolicy:
    updateMode: "Auto"

KEDA (Event-Driven Autoscaling)

Detect KEDA Installation

keda_detect_tool()

List ScaledObjects

keda_scaledobjects_list_tool(namespace)
keda_scaledobject_get_tool(name, namespace)

List ScaledJobs

keda_scaledjobs_list_tool(namespace)

Trigger Authentication

keda_triggerauths_list_tool(namespace)
keda_triggerauth_get_tool(name, namespace)

KEDA-Managed HPAs

keda_hpa_list_tool(namespace)

See KEDA-TRIGGERS.md for trigger configurations.

Common KEDA Triggers

Queue-Based Scaling (AWS SQS)

apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
  name: sqs-scaler
spec:
  scaleTargetRef:
    name: queue-processor
  minReplicaCount: 0  # Scale to zero!
  maxReplicaCount: 100
  triggers:
  - type: aws-sqs-queue
    metadata:
      queueURL: https://sqs.region.amazonaws.com/...
      queueLength: "5"

Cron-Based Scaling

triggers:
- type: cron
  metadata:
    timezone: America/New_York
    start: 0 8 * * 1-5   # 8 AM weekdays
    end: 0 18 * * 1-5    # 6 PM weekdays
    desiredReplicas: "10"

Prometheus Metrics

triggers:
- type: prometheus
  metadata:
    serverAddress: http://prometheus:9090
    metricName: http_requests_total
    query: sum(rate(http_requests_total{app="myapp"}[2m]))
    threshold: "100"

Scaling Strategies

StrategyToolUse Case
CPU/MemoryHPASteady traffic patterns
Custom metricsHPA v2Business metrics
Event-drivenKEDAQueue processing, cron
VerticalVPARight-size requests
Scale to zeroKEDACost savings, idle workloads

Cost-Optimized Autoscaling

Scale to Zero with KEDA

Reduce costs for idle workloads:

keda_scaledobjects_list_tool(namespace)
# ScaledObjects with minReplicaCount: 0 can scale to zero

Right-Size with VPA

Get recommendations and apply:

get_resource_recommendations(namespace)
# Apply VPA recommendations

Predictive Scaling

Use cron triggers for known patterns:

# Scale up before traffic spike
triggers:
- type: cron
  metadata:
    start: 0 7 * * *  # 7 AM
    end: 0 9 * * *    # 9 AM
    desiredReplicas: "20"

Multi-Cluster Autoscaling

Configure KEDA across clusters:

keda_scaledobjects_list_tool(namespace, context="production")
keda_scaledobjects_list_tool(namespace, context="staging")

Troubleshooting

HPA Not Scaling

get_hpa(namespace)
get_pod_metrics(name, namespace)  # Metrics available?
describe_pod(name, namespace)     # Resource requests set?

KEDA Not Triggering

keda_scaledobject_get_tool(name, namespace)  # Check status
get_events(namespace)                        # Check events

Common Issues

SymptomCheckResolution
HPA unknownMetrics serverInstall metrics-server
KEDA no scaleTrigger authCheck TriggerAuthentication
VPA not updatingUpdate modeSet updateMode: Auto
Scale down slowStabilizationAdjust stabilizationWindowSeconds

Best Practices

  1. Always Set Resource Requests

    • HPA requires requests to calculate utilization
  2. Use Multiple Metrics

    • Combine CPU + custom metrics for accuracy
  3. Stabilization Windows

    • Prevent flapping with scaleDown stabilization
  4. Scale to Zero Carefully

    • Consider cold start time
    • Use activation threshold

Related Skills

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

Omniscient

全知全能技能 — 整合认知套件、执行框架、系统控制三大能力层,并配备编排引擎。 认知层:四种思维操作码(直用/改进/迁移/构建)覆盖所有思考任务; 执行层:大语言模型 + 命令执行工具,自动化代码生成与脚本执行; 操控层:Windows桌面软件、系统硬件、串口设备、物联网平台、图形界面自动化、蓝牙设备、GPU显卡...

Registry SourceRecently Updated
General

系统清理技能

定期清理OpenClaw系统中的备份、临时及会话文件,分析磁盘使用并检查系统状态,优化系统性能。

Registry SourceRecently Updated
General

Whoislookup

Look up domain WHOIS registration info — registrar, creation date, expiry date, nameservers, and domain status. Use when asked to check who owns a domain, wh...

Registry SourceRecently Updated
General

WayinVideo - Find Moments in the Video

Find specific moments in a video using a natural language query. Ideal for locating particular scenes, topics, or events in long videos (e.g., “the part wher...

Registry SourceRecently Updated