Configure Kubernetes autoscaling with HPA, VPA, and KEDA. Use for horizontal/vertical pod autoscaling, event-driven scaling, and capacity management.
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install k8-autoscaling或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install k8-autoscaling⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/k8-autoscaling/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: k8s-autoscaling description: Configure Kubernetes autoscaling with HPA, VPA, and KEDA. Use for horizontal/vertical pod autoscaling, event-driven scaling, and capacity management. ---
Comprehensive autoscaling using HPA, VPA, and KEDA with kubectl-mcp-server tools.
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)
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_detect_tool()
keda_scaledobjects_list_tool(namespace)
keda_scaledobject_get_tool(name, namespace)
keda_scaledjobs_list_tool(namespace)
keda_triggerauths_list_tool(namespace)
keda_triggerauth_get_tool(name, namespace)
keda_hpa_list_tool(namespace)
See KEDA-TRIGGERS.md for trigger configurations.
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"
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"
triggers:
- type: prometheus
metadata:
serverAddress: http://prometheus:9090
metricName: http_requests_total
query: sum(rate(http_requests_total{app="myapp"}[2m]))
threshold: "100"
| Strategy | Tool | Use Case | |----------|------|----------| | CPU/Memory | HPA | Steady traffic patterns | | Custom metrics | HPA v2 | Business metrics | | Event-driven | KEDA | Queue processing, cron | | Vertical | VPA | Right-size requests | | Scale to zero | KEDA | Cost savings, idle workloads |
Reduce costs for idle workloads:
keda_scaledobjects_list_tool(namespace)
# ScaledObjects with minReplicaCount: 0 can scale to zero
Get recommendations and apply:
get_resource_recommendations(namespace)
# Apply VPA recommendations
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"
Configure KEDA across clusters:
keda_scaledobjects_list_tool(namespace, context="production")
keda_scaledobjects_list_tool(namespace, context="staging")
get_hpa(namespace)
get_pod_metrics(name, namespace) # Metrics available?
describe_pod(name, namespace) # Resource requests set?
keda_scaledobject_get_tool(name, namespace) # Check status
get_events(namespace) # Check events
| Symptom | Check | Resolution | |---------|-------|------------| | HPA unknown | Metrics server | Install metrics-server | | KEDA no scale | Trigger auth | Check TriggerAuthentication | | VPA not updating | Update mode | Set updateMode: Auto | | Scale down slow | Stabilization | Adjust stabilizationWindowSeconds |
- HPA requires requests to calculate utilization
- Combine CPU + custom metrics for accuracy
- Prevent flapping with scaleDown stabilization
- Consider cold start time - Use activation threshold
安装 Kubernetes Skills 后,可以对 AI 说这些话来触发它
Help me get started with Kubernetes Skills
Explains what Kubernetes Skills does, walks through the setup, and runs a quick demo based on your current project
Use Kubernetes Skills to configure Kubernetes autoscaling with HPA, VPA, and KEDA
Invokes Kubernetes Skills with the right parameters and returns the result directly in the conversation
What can I do with Kubernetes Skills in my developer & devops workflow?
Lists the top use cases for Kubernetes Skills, with example commands for each scenario
将技能文件夹放到 ~/.claude/skills/k8-autoscaling/ 目录(个人级,所有项目可用),或 .claude/skills/k8-autoscaling/(项目级)。重启 AI 客户端后,用 /k8-autoscaling 主动调用,或让 AI 根据上下文自动发现并使用。
Kubernetes Skills 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
Kubernetes Skills 可免费安装使用。请查阅仓库了解许可证信息。
Configure Kubernetes autoscaling with HPA, VPA, and KEDA. Use for horizontal/vertical pod autoscaling, event-driven scaling, and capacity management.
Kubernetes Skills 属于「Developer & DevOps」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。
Automate my developer & devops tasks using Kubernetes Skills
Identifies repetitive steps in your workflow and sets up Kubernetes Skills to handle them automatically