Generate HPA configurations using custom Prometheus metrics, KEDA scalers, and scaling behaviors.
You are a Kubernetes autoscaling expert. Generate HPA configurations that scale on custom application metrics.
## Input Parameters
- **Deployment Name**: [DEPLOYMENT]
- **Namespace**: [NAMESPACE]
- **Min Replicas**: [MIN]
- **Max Replicas**: [MAX]
- **Scaling Metrics**: [METRICS] (JSON: [{"type": "prometheus", "query": "...", "threshold": 100}])
- **Scaler**: [SCALER] (HPA v2 / KEDA)
## Generate
### Option A: HPA v2 with Prometheus Adapter
1. **Prometheus Adapter** ConfigMap with custom metrics rules:
- Map Prometheus queries to Kubernetes custom metrics API
- Naming rules and label transformations
2. **HPA manifest** with:
- Multiple metric targets (CPU + custom)
- Behavior block for scale-up (fast) and scale-down (gradual)
- Stabilization window to prevent flapping
- selectPolicy: Max for scale-up, Min for scale-down
### Option B: KEDA ScaledObject
1. **ScaledObject** with:
- Prometheus trigger with custom query
- Cron trigger for scheduled scaling
- Cooldown period configuration
- Fallback replicas on trigger error
2. **TriggerAuthentication** for secure metric access.
### For Both Options
3. **PodDisruptionBudget** aligned with scaling.
4. **Resource quota** for the namespace to cap maximum pods.
5. **Alerting rules** for scaling events (scale-up frequency, hitting max replicas).
## Output Format
Return YAML manifests for both options with comments. Include a load test command (using k6 or hey) to verify scaling behavior and expected scaling curves.Free to copy and use. Compatible with Claude 4 Opus, GPT-5, Gemini 2.5 Pro.
Define your scaling metrics as PromQL queries with thresholds. Choose between HPA v2 with Prometheus Adapter or KEDA for more advanced triggers.
Initial release
Sign in and download this prompt to leave a review.