Quick Start Guide
Get started with OptiPod in minutes. This guide walks you through installing OptiPod and creating your first optimization policy in safe Recommend mode.
What You’ll Learn
Section titled “What You’ll Learn”- Install OptiPod in your cluster
- Create a basic optimization policy
- Review recommendations on your workloads
- Understand the safety model
Step 1: Install OptiPod
Section titled “Step 1: Install OptiPod”Install OptiPod using Helm (recommended):
helm install optipod oci://ghcr.io/sagart-cactus/charts/optipod \ --namespace optipod-system \ --create-namespaceVerify the installation:
# Check pods are runningkubectl get pods -n optipod-system
# Expected output:# NAME READY STATUS RESTARTS AGE# optipod-controller-manager-xxx 1/1 Running 0 1m# optipod-webhook-xxx 1/1 Running 0 1mStep 2: Create Your First Policy
Section titled “Step 2: Create Your First Policy”Create a file named my-first-policy.yaml:
apiVersion: optipod.optipod.io/v1alpha1kind: OptimizationPolicymetadata: name: safe-recommendations namespace: defaultspec: # Recommend mode: safe to try, no mutations mode: Recommend
# Target workloads with the label optipod.io/enabled=true selector: workloadSelector: matchLabels: optipod.io/enabled: "true"
# Metrics configuration metricsConfig: provider: metrics-server rollingWindow: 24h percentile: P90 safetyFactor: 1.2
# Resource bounds resourceBounds: cpu: min: "100m" max: "4000m" memory: min: "128Mi" max: "8Gi"
# Update strategy (not used in Recommend mode) updateStrategy: allowInPlaceResize: true allowRecreate: false updateRequestsOnly: trueApply the policy:
kubectl apply -f my-first-policy.yamlStep 3: Label a Workload
Section titled “Step 3: Label a Workload”Label an existing deployment to enable optimization:
# Label your deploymentkubectl label deployment my-app optipod.io/enabled=true
# Or create a new deployment with the labelkubectl create deployment nginx --image=nginx:latestkubectl label deployment nginx optipod.io/enabled=trueStep 4: Review Recommendations
Section titled “Step 4: Review Recommendations”Wait a few minutes for OptiPod to collect metrics and generate recommendations.
Check Policy Status
Section titled “Check Policy Status”kubectl describe optimizationpolicy safe-recommendations -n defaultYou’ll see aggregate information like:
Status: Workloads Discovered: 5 Workloads Processed: 5 Workloads By Type: Deployment: 5 Last Reconciliation: 2025-01-28T10:30:00ZView Individual Workload Recommendations
Section titled “View Individual Workload Recommendations”Recommendations are stored as annotations on each workload:
# View recommendations for a specific deploymentkubectl get deployment nginx -o yaml | grep -A10 "optipod.io/recommendation"You’ll see annotations like:
metadata: annotations: optipod.io/managed: "true" optipod.io/policy: "safe-recommendations" optipod.io/last-recommendation: "2025-01-28T10:30:00Z" optipod.io/recommendation.nginx.cpu-request: "250m" optipod.io/recommendation.nginx.memory-request: "512Mi"Step 5: Generate an Impact Report
Section titled “Step 5: Generate an Impact Report”Before switching to Auto mode, generate a report to see the potential impact:
# Download the report scriptcurl -fsSL https://raw.githubusercontent.com/Sagart-cactus/optipod/main/scripts/optipod-recommendation-report.sh -o optipod-recommendation-report.shchmod +x optipod-recommendation-report.sh
# Generate HTML report./optipod-recommendation-report.sh -o html -f optipod-impact.html
# Open the report in your browseropen optipod-impact.html # macOSxdg-open optipod-impact.html # LinuxThe report shows:
- Total CPU and memory changes across all workloads
- Per-workload recommendations
- Warnings for potential issues
- Replica-weighted impact calculations
Understanding the Safety Model
Section titled “Understanding the Safety Model”Recommend Mode (Safe Default)
Section titled “Recommend Mode (Safe Default)”In Recommend mode:
- ✅ No workloads are modified
- ✅ No pods are restarted
- ✅ Recommendations are written as annotations
- ✅ Safe to try in production
Auto Mode (Opt-In)
Section titled “Auto Mode (Opt-In)”To enable automatic application of recommendations:
spec: mode: Auto # Change from Recommend to AutoImportant: Only switch to Auto mode after:
- Reviewing recommendations in Recommend mode
- Generating and reviewing the impact report
- Testing in a non-production environment
- Ensuring your resource bounds are appropriate
Safety Features
Section titled “Safety Features”OptiPod includes multiple safety mechanisms:
- Resource Bounds: Min/max limits prevent extreme recommendations
- Safety Factor: Adds a buffer (e.g., 1.2 = 20% above observed usage)
- Percentile-Based: Uses P90/P95 instead of average to handle spikes
- Rolling Window: Analyzes metrics over time (e.g., 24h) for stability
- Update Controls: Configure what can be updated and when
Next Steps
Section titled “Next Steps”Learn More About OptiPod
Section titled “Learn More About OptiPod”- Creating Your First Policy - Detailed policy configuration guide
- Architecture Overview - Understand how OptiPod works
- Operational Modes - Learn about Auto, Recommend, and Disabled modes
Configure Advanced Features
Section titled “Configure Advanced Features”- Update Strategies - SSA vs Webhook strategies
- Safety Model - Understand safety guarantees
- GitOps Integration - Use OptiPod with ArgoCD/Flux
Troubleshooting
Section titled “Troubleshooting”- Troubleshooting Guide - Common issues and solutions
Common Questions
Section titled “Common Questions”Why aren’t recommendations appearing?
Section titled “Why aren’t recommendations appearing?”Recommendations require:
- Sufficient metrics data (default: 10 samples over rolling window)
- Workloads must be running and consuming resources
- Workloads must match the policy selector
Check controller logs:
kubectl logs -n optipod-system -l app.kubernetes.io/component=controller --tail=50How long does it take to see recommendations?
Section titled “How long does it take to see recommendations?”- metrics-server: 5-10 minutes (depends on sampling interval)
- Prometheus: Immediate (uses historical data)
Can I use OptiPod with ArgoCD?
Section titled “Can I use OptiPod with ArgoCD?”Yes! OptiPod is designed to be GitOps-safe:
- Use webhook strategy for ArgoCD compatibility
- Recommendations are stored in workload metadata (not spec)
- No sync conflicts with GitOps tools
See the GitOps Integration Guide for details.
What happens if I delete a policy?
Section titled “What happens if I delete a policy?”- OptiPod stops processing workloads under that policy
- Existing recommendations remain as annotations
- No automatic rollback of applied changes
Summary
Section titled “Summary”You’ve successfully:
- ✅ Installed OptiPod
- ✅ Created an optimization policy in safe Recommend mode
- ✅ Labeled a workload for optimization
- ✅ Reviewed recommendations
- ✅ Generated an impact report
OptiPod is now monitoring your workloads and providing recommendations. When you’re ready, you can switch to Auto mode to apply recommendations automatically.
For production deployments, see the Installation Guide for advanced configuration options.