AI-powered Kubernetes resource optimization tool that analyzes pod metrics and provides intelligent recommendations using GPT-4/Claude for cost reduction and performance improvement.
Interactive dashboard showing cluster metrics, AI recommendations, and resource optimization insights
- 📊 Real-time Cluster Monitoring - Mock data simulation with realistic metrics
- 🤖 AI-Powered Recommendations - OpenAI GPT-4 and Anthropic Claude integration
- 📈 Interactive Dashboard - Streamlit-based web interface with visualizations
- 🔧 YAML Generation - Automatic generation of optimized resource configurations
- 📋 Resource Analysis - Identify over-provisioned and under-provisioned workloads
- 💰 Cost Optimization - Calculate potential savings and ROI
- 🎯 Risk Assessment - Evaluate implementation risks and mitigation strategies
- Python 3.9 or higher
- pip package manager
git clone https://github.com/apollofps/kubernetes-ai-copilot.git
cd kubernetes-ai-copilot
chmod +x quick_start.sh
./quick_start.sh-
Clone the Repository
git clone https://github.com/apollofps/kubernetes-ai-copilot.git cd kubernetes-ai-copilot -
Install Dependencies
pip install -r requirements.txt
-
Configure API Keys (Optional)
cp .env.example .env # Edit .env and add your OpenAI and/or Anthropic API keys -
Run the Application
streamlit run app.py
-
Open in Browser Navigate to
http://localhost:8501
Run the demo script to see all features without API keys:
python3 demo.py
Main dashboard showing cluster overview, efficiency metrics, and optimization opportunities
Detailed recommendations table with severity indicators and potential savings
Resource utilization heatmap and trend analysis charts
The application supports both OpenAI and Anthropic Claude APIs. Configure your preferred provider in the .env file:
OPENAI_API_KEY- Your OpenAI API keyANTHROPIC_API_KEY- Your Anthropic API keyDEFAULT_LLM_PROVIDER- Set to "openai" or "anthropic"
This POC uses realistic mock data including:
- 3-5 namespaces with 10-20 pods each
- Various workload types (microservices, databases, batch jobs)
- Resource utilization patterns and issues
- Historical metrics for trend analysis
├── app.py # Main Streamlit application
├── requirements.txt # Python dependencies
├── .env.example # Environment variables template
├── src/
│ ├── mock_data.py # Mock cluster data generation
│ ├── metrics_analyzer.py # Resource analysis engine
│ ├── llm_client.py # LLM integration
│ ├── yaml_generator.py # YAML diff generation
│ └── recommendations.py # Recommendation processing
└── config/
└── mock_clusters.yaml # Mock cluster configurations
- Select LLM Provider - Choose between OpenAI or Claude in the sidebar
- Filter Data - Use namespace and severity filters to focus on specific issues
- Review Recommendations - Browse AI-generated optimization suggestions
- Analyze Details - Click on recommendations for detailed analysis and YAML diffs
- Export Changes - Copy or download optimized YAML configurations
- Frontend: Streamlit, Plotly
- Backend: Python 3.9+
- AI/ML: OpenAI GPT-4, Anthropic Claude
- Data Processing: Pandas, NumPy
- Configuration: PyYAML, python-dotenv
- Visualization: Plotly, Streamlit Charts
The application successfully demonstrates:
- ✅ 41 pods generated across 4 namespaces
- ✅ 73.8% overall efficiency with optimization opportunities
- ✅ $2,577.53/month in potential savings identified
- ✅ 1,508.8% annual ROI with 0.8-month payback period
- ✅ Complete YAML generation with kubectl commands
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- OpenAI for GPT-4 API
- Anthropic for Claude API
- Streamlit team for the amazing web framework
- Kubernetes community for inspiration