Recommendations
import { Card, CardGrid } from โ@astrojs/starlight/componentsโ;
GreenKube analyzes your cluster metrics to generate actionable recommendations that reduce both costs and carbon emissions.
Recommendation Engine
Section titled โRecommendation EngineโThe recommendation engine examines metrics collected over a configurable lookback period (default: 7 days) and applies multiple analysis algorithms:
Recommendation Types
Section titled โRecommendation Typesโ๐ง Zombie Pods (ZOMBIE_POD)
Section titled โ๐ง Zombie Pods (ZOMBIE_POD)โWhat: Pods that are running and consuming resources but show minimal CPU/energy usage.
Detection Criteria:
- CPU usage consistently below threshold
- Energy consumption below
zombieEnergyThreshold(default: 1000 J) - Cost above
zombieCostThreshold(default: $0.01) - Running for extended periods
Example Output:
๐ง ZOMBIE POD โ High SeverityPod: legacy-api-deployment-5d8f7c-k2m4pNamespace: staging CPU usage: 2m (avg over 7 days) Energy: 450 J Cost: $0.85/day Estimated savings: $0.85/day, 3.2g COโe/day Action: Consider terminating this idle workload kubectl delete deployment legacy-api-deployment -n staging๐ Rightsizing (RIGHTSIZING_CPU / RIGHTSIZING_MEMORY)
Section titled โ๐ Rightsizing (RIGHTSIZING_CPU / RIGHTSIZING_MEMORY)โWhat: Pods with resource requests (CPU or memory) significantly higher than actual utilization. Two sub-types: RIGHTSIZING_CPU for over-provisioned CPU and RIGHTSIZING_MEMORY for over-provisioned memory.
Detection Criteria:
- Average CPU usage <
rightsizingCpuThresholdร CPU request (default: 30%) - Average memory usage <
rightsizingMemoryThresholdร memory request (default: 30%) - Applies
rightsizingHeadroommultiplier (default: 1.2x) for safe recommendations
Example Output:
๐ RIGHTSIZING โ Medium SeverityPod: web-frontend-7b5f8c9d6-x2k4pNamespace: production CPU: Using 45m of 500m requested (9%) Recommendation: Reduce CPU request to 55m (45m ร 1.2 headroom) Memory: Using 128Mi of 512Mi requested (25%) Recommendation: Reduce memory request to 154Mi Estimated savings: $1.20/day, 5.4g COโe/day๐ Autoscaling Candidates (AUTOSCALING_CANDIDATE)
Section titled โ๐ Autoscaling Candidates (AUTOSCALING_CANDIDATE)โWhat: Workloads with high variability in resource usage that would benefit from autoscaling.
Detection Criteria:
- High coefficient of variation (CV >
autoscalingCvThreshold, default: 0.7) - Spike detection (max/avg ratio >
autoscalingSpikeRatio, default: 3.0) - No existing HPA/VPA detected
Example Output:
๐ AUTOSCALING โ Medium SeverityPod: batch-processor-deployment-8c7d6-n3m2pNamespace: default CPU variability: CV = 1.2 (high) Peak: 800m, Average: 150m (5.3x spike ratio) Recommendation: Configure HPA with: minReplicas: 1, maxReplicas: 5 targetCPUUtilization: 70%๐ Carbon-Aware Scheduling (CARBON_AWARE_SCHEDULING)
Section titled โ๐ Carbon-Aware Scheduling (CARBON_AWARE_SCHEDULING)โWhat: Batch or deferrable workloads that could be scheduled during periods of lower grid carbon intensity.
Detection Criteria:
- Grid intensity during workload execution exceeds
carbonAwareThresholdร average (default: 1.5x) - Workload appears to be a batch job (CronJob, Job owner)
- Lower-intensity periods available in the same zone
Example Output:
๐ CARBON-AWARE โ Low SeverityPod: nightly-etl-job-28445-k2m4pNamespace: data-pipeline Current intensity: 520 gCOโe/kWh (peak hours) Average zone intensity: 280 gCOโe/kWh Recommendation: Schedule during off-peak hours (02:00-06:00 UTC) Estimated savings: 8.5g COโe/run๐๏ธ Idle Namespace Cleanup (IDLE_NAMESPACE)
Section titled โ๐๏ธ Idle Namespace Cleanup (IDLE_NAMESPACE)โWhat: Namespaces with minimal activity that may contain forgotten resources.
Detection Criteria:
- Total energy below
idleNamespaceEnergyThreshold(default: 1000 J) - Low pod count with minimal resource usage
๐ Off-Peak Scaling (OFF_PEAK_SCALING)
Section titled โ๐ Off-Peak Scaling (OFF_PEAK_SCALING)โWhat: Workloads that maintain high resource allocation during off-peak hours and could benefit from scheduled scaling down.
Detection Criteria:
- Consistently low utilization during off-peak periods
- Workloads without existing time-based scaling policies
๐ฅ๏ธ Overprovisioned Node (OVERPROVISIONED_NODE)
Section titled โ๐ฅ๏ธ Overprovisioned Node (OVERPROVISIONED_NODE)โWhat: Nodes with significantly more capacity than what the scheduled pods require.
Detection Criteria:
- Node resource utilization consistently below threshold
- Opportunity to consolidate workloads onto fewer, right-sized nodes
๐ค Underutilized Node (UNDERUTILIZED_NODE)
Section titled โ๐ค Underutilized Node (UNDERUTILIZED_NODE)โWhat: Nodes running with very low utilization that are wasting energy and money.
Detection Criteria:
- Node utilization below
nodeUtilizationThreshold(default: 20%) - Running for extended periods at low usage
Using Recommendations
Section titled โUsing Recommendationsโ# Get all recommendationsgreenkube recommend
# Filter by namespacegreenkube recommend -n production
# JSON output for automationgreenkube recommend --format jsoncurl "http://localhost:8000/api/v1/recommendations?namespace=production"Dashboard
Section titled โDashboardโNavigate to the Recommendations tab in the web dashboard for a visual, filterable view of all suggestions.
Tuning Thresholds
Section titled โTuning ThresholdsโAll thresholds are configurable via Helm values:
config: recommendations: lookbackDays: 7 rightsizingCpuThreshold: 0.3 # 30% usage triggers rightsizing rightsizingMemoryThreshold: 0.3 rightsizingHeadroom: 1.2 # 20% safety margin zombieCostThreshold: 0.01 # $0.01/day minimum zombieEnergyThreshold: 1000 # 1000 Joules minimum autoscalingCvThreshold: 0.7 # High variability autoscalingSpikeRatio: 3.0 # 3x spike ratio carbonAwareThreshold: 1.5 # 1.5x average intensityAdjust these based on your cluster size, workload patterns, and organizational priorities.