/karpenter-provision
Purpose
Generate production-ready Karpenter configurations (NodePool + EC2NodeClass) optimized for cost, reliability, and the specific workload characteristics.
Requirement Gathering
Ask the user for these details (if not already provided):
- Workload type: stateless API, stateful (database/cache), batch/CI, GPU/ML, mixed
- Resources per pod: typical vCPU and memory requests
- Capacity type: on-demand only, spot only, or mixed (specify ratio)
- Monthly budget target: helps size limits appropriately
- Region and AZs: for subnet and zone configuration
- EKS version and Karpenter version: for API compatibility
- Special requirements: GPU, ARM64, high-memory, Windows, etc.
Generation Rules
Instance Type Selection
- Stateless APIs: c6i, c7g, m6i, m7g (compute/general purpose, good price-performance)
- Memory-intensive: r6i, r7g, r6a (memory optimized)
- Batch/CI: c6i, c6a, c7g, c7a, m6i, m6a, m7g (maximize diversity for Spot)
- GPU: p4d, p5, g5, g6 (match GPU type to workload: training vs inference)
- ARM64 preferred: Include Graviton variants (c7g, m7g, r7g) — 20-40% cheaper
Instance Size Selection
- Match to pod resource requests: if pods need 2 vCPU/4GB, use large to 2xlarge
- Avoid oversized instances (4xlarge+) unless pods are large or bin-packing is critical
- Include at least 3 sizes for flexibility
Spot Strategy
- Minimum 15 instance types for Spot-to-Spot consolidation
- Always include on-demand fallback for mixed strategies
- Use
weight field: Spot NodePool weight=100, On-Demand weight=10 (fallback)
- Configure interruption handling (SQS + EventBridge)
Disruption Policy
- Production:
consolidateAfter: 60s, budgets: nodes: "20%"
- Batch:
consolidateAfter: 30s, budgets: nodes: "40%"
- Add peak-hours protection budget for production
- Use
WhenEmptyOrUnderutilized (default, recommended for most cases)
Limits
- Set based on budget (rough formula: $0.04/vCPU-hour on-demand, $0.015 spot)
- Include both
cpu and memory limits
- Leave 20% headroom above expected peak
Output
Generate complete YAML files:
NodePool(s) with:
- Instance family and size requirements
- Capacity type (on-demand/spot)
- AZ requirements
- Labels and taints (for workload isolation)
- Disruption policy with budgets
- Resource limits
- Weight (priority)
- expireAfter (TTL for node rotation)
EC2NodeClass with:
- amiSelectorTerms (alias for EKS-optimized AMI)
- subnetSelectorTerms (tag-based discovery)
- securityGroupSelectorTerms (tag-based discovery)
- instanceProfile
- blockDeviceMappings (root volume sizing)
Supporting resources:
- PodDisruptionBudget for the primary workload
- Recommended Prometheus ServiceMonitor config for Karpenter
Validation Checklist
Before presenting the configuration, verify:
Examples
Common configurations the skill should handle:
- "Provision for a microservices platform with 50 stateless APIs"
- "Set up Karpenter for ML training workloads with p5.48xlarge GPUs"
- "Configure Spot-only NodePool for CI/CD runners"
- "Mixed strategy: critical payment service on On-Demand, everything else on Spot"
- "ARM64-first strategy with x86 fallback for cost optimization"
1---2name: karpenter-provision3description: Generate optimized Karpenter NodePool and EC2NodeClass configurations based on workload requirements. Handles Spot strategies, disruption budgets, instance diversity, and cost optimization.4---56# /karpenter-provision78## Purpose9Generate production-ready Karpenter configurations (NodePool + EC2NodeClass) optimized for cost, reliability, and the specific workload characteristics.1011## Requirement Gathering1213Ask the user for these details (if not already provided):14151. **Workload type**: stateless API, stateful (database/cache), batch/CI, GPU/ML, mixed162. **Resources per pod**: typical vCPU and memory requests173. **Capacity type**: on-demand only, spot only, or mixed (specify ratio)184. **Monthly budget target**: helps size limits appropriately195. **Region and AZs**: for subnet and zone configuration206. **EKS version and Karpenter version**: for API compatibility217. **Special requirements**: GPU, ARM64, high-memory, Windows, etc.2223## Generation Rules2425### Instance Type Selection26- **Stateless APIs**: c6i, c7g, m6i, m7g (compute/general purpose, good price-performance)27- **Memory-intensive**: r6i, r7g, r6a (memory optimized)28- **Batch/CI**: c6i, c6a, c7g, c7a, m6i, m6a, m7g (maximize diversity for Spot)29- **GPU**: p4d, p5, g5, g6 (match GPU type to workload: training vs inference)30- **ARM64 preferred**: Include Graviton variants (c7g, m7g, r7g) — 20-40% cheaper3132### Instance Size Selection33- Match to pod resource requests: if pods need 2 vCPU/4GB, use large to 2xlarge34- Avoid oversized instances (4xlarge+) unless pods are large or bin-packing is critical35- Include at least 3 sizes for flexibility3637### Spot Strategy38- **Minimum 15 instance types** for Spot-to-Spot consolidation39- Always include on-demand fallback for mixed strategies40- Use `weight` field: Spot NodePool weight=100, On-Demand weight=10 (fallback)41- Configure interruption handling (SQS + EventBridge)4243### Disruption Policy44- Production: `consolidateAfter: 60s`, budgets: `nodes: "20%"`45- Batch: `consolidateAfter: 30s`, budgets: `nodes: "40%"`46- Add peak-hours protection budget for production47- Use `WhenEmptyOrUnderutilized` (default, recommended for most cases)4849### Limits50- Set based on budget (rough formula: $0.04/vCPU-hour on-demand, $0.015 spot)51- Include both `cpu` and `memory` limits52- Leave 20% headroom above expected peak5354## Output5556Generate complete YAML files:57581. **NodePool(s)** with:59 - Instance family and size requirements60 - Capacity type (on-demand/spot)61 - AZ requirements62 - Labels and taints (for workload isolation)63 - Disruption policy with budgets64 - Resource limits65 - Weight (priority)66 - expireAfter (TTL for node rotation)67682. **EC2NodeClass** with:69 - amiSelectorTerms (alias for EKS-optimized AMI)70 - subnetSelectorTerms (tag-based discovery)71 - securityGroupSelectorTerms (tag-based discovery)72 - instanceProfile73 - blockDeviceMappings (root volume sizing)74753. **Supporting resources**:76 - PodDisruptionBudget for the primary workload77 - Recommended Prometheus ServiceMonitor config for Karpenter7879## Validation Checklist8081Before presenting the configuration, verify:8283- [ ] Instance type diversity: ≥15 types for Spot, ≥6 for On-Demand84- [ ] All 3 AZs included for HA (if multi-AZ requested)85- [ ] Resource limits align with budget target86- [ ] consolidateAfter is appropriate (not 0s in production)87- [ ] Peak-hours budget protection included for production workloads88- [ ] Taints configured for workload isolation (if multiple NodePools)89- [ ] expireAfter set for node rotation (720h prod, 168h batch recommended)90- [ ] amiSelectorTerms uses alias (not custom AMI) unless specifically required91- [ ] No launch template references (not supported in v1 API)9293## Examples9495Common configurations the skill should handle:9697- "Provision for a microservices platform with 50 stateless APIs"98- "Set up Karpenter for ML training workloads with p5.48xlarge GPUs"99- "Configure Spot-only NodePool for CI/CD runners"100- "Mixed strategy: critical payment service on On-Demand, everything else on Spot"101- "ARM64-first strategy with x86 fallback for cost optimization"