---
name: "kubernetes-hpa-custom-metrics"
description: "Autoscale Kubernetes pods horizontally based on custom Prometheus business metrics."
metadata:
  author: "Kubernetes"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "configure k8s hpa v2"
  - "autoscale on http requests prometheus"
  - "setup prometheus adapter hpa"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# Kubernetes HPA Custom Metrics & Prometheus Adapter

Configures HorizontalPodAutoscaler (HPA v2): integrating Prometheus Adapter, defining custom metrics (HTTP requests/second, queue depth), tuning scaling behaviors (stabilizationWindowSeconds), and scaling policies.

## When to Invoke
Invoke this skill whenever you need to:
- configure k8s hpa v2
- autoscale on http requests prometheus
- setup prometheus adapter hpa

## Execution SOP & Rules
1. Deploy prometheus-adapter with custom metric discovery rules in values.yaml.
2. Define HPA with apiVersion: autoscaling/v2 and type: Pods or Object metric source.
3. Configure scaleUp and scaleDown behavior blocks with appropriate periodSeconds and select policies.
4. Verify metrics are actively available via kubectl get --raw '/apis/custom.metrics.k8s.io/v1beta1'.

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
