akishorekumar-1728/ai-incident-response

GitHub: akishorekumar-1728/ai-incident-response

该平台利用 Gemini AI 对 Kubernetes 集群的日志与指标进行自动分析,帮助 DevOps 工程师实现事件根因诊断与实时监控。

Stars: 1 | Forks: 0

# 🚀 AI 事件响应平台 一个由 AI 驱动的 Kubernetes 事件响应平台,可监控 Kubernetes 工作负载、收集日志和指标、使用 Google Gemini AI 分析事件、通过 Prometheus & Grafana 可视化指标,并为 DevOps 工程师提供一个现代化的仪表板。 ## 功能 - Kubernetes Pod 监控 - AI 根因分析 - FastAPI REST API - Docker 容器化 - Minikube 支持 - Prometheus 指标 - Grafana 仪表板 - Kubernetes 日志收集 - 事件报告生成 - 精美的前端仪表板 - 备用 AI 分析 - 邮件告警模块(可扩展) ## 技术栈 | 技术 | 用途 | |------------|---------| | Python | 后端 | | FastAPI | REST API | | Docker | 容器化 | | Kubernetes (Minikube) | 容器编排 | | Prometheus | 监控 | | Grafana | 可视化 | | Google Gemini AI | 事件分析 | | SQLite | 事件存储 | | HTML/CSS/JavaScript | 前端 | # 架构 ``` Kubernetes Cluster │ ┌────────────┴────────────┐ │ │ Pod Logs Metrics │ │ └────────────┬────────────┘ │ AI Incident Engine │ ┌────────────┼────────────┐ │ │ │ Gemini AI SQLite DB Reports │ FastAPI Backend │ Frontend Dashboard │ Prometheus → Grafana ``` # 项目结构 ``` AI-Incident-Response │ ├── ai/ ├── backend/ ├── database/ ├── docker/ ├── docs/ ├── frontend/ ├── k8s/ ├── monitoring/ ├── reports/ ├── .env.example ├── docker-compose.yml ├── requirements.txt └── README.md ``` # 仪表板 ## AI 事件仪表板 ![替代文本](https://static.pigsec.cn/wp-content/uploads/repos/cas/08/08be00721266f77cb42996eea8cd49900a224682aba829e1a048ffb608c09c76.png) ## Swagger API ![替代文本](https://static.pigsec.cn/wp-content/uploads/repos/cas/50/50c5f7ee169d48d03a5af68c713788b09a8215f07c51c8ad37e3212b5c0c53a5.png) ## Grafana 仪表板 ![替代文本](https://static.pigsec.cn/wp-content/uploads/repos/cas/d6/d666934657bc7784e526f5033d402713ba00c7a24895930500788a32d248d040.png) ## Prometheus Targets ![替代文本](https://static.pigsec.cn/wp-content/uploads/repos/cas/b2/b2ec82450976b6c4e4d9645dedb9ef6622f3d6c296ad7370c64a2ed2d7f35abd.png) ## Kubernetes Pods ![替代文本](https://static.pigsec.cn/wp-content/uploads/repos/cas/03/03728170c98c001238026d15ed335f9362c162e570e09c0769e6685120c3fdc8.png) ## Docker Containers ![替代文本](https://static.pigsec.cn/wp-content/uploads/repos/cas/61/615a20bf935b5e029cce2023fd564c7fe974532b304f0df6779cbfbf236e8c9a.png) ## Minikube ![替代文本](https://static.pigsec.cn/wp-content/uploads/repos/cas/76/76103eba7839e294e2cd68cbfb3b56db7d5274ffa9d4c34e59102200700a8e67.png) # 安装说明 ## 克隆仓库 ``` git clone https://github.com/akishorekumar-1728/ai-incident-response.git cd ai-incident-response ``` ## 安装依赖 ``` pip install -r requirements.txt ``` ## 配置环境 创建 ``` .env ``` 示例: ``` GEMINI_API_KEY=your_api_key DATABASE_NAME=incident.db KUBECONFIG=/root/.kube/config ``` ## 启动服务 ``` docker compose up -d ``` ## 启动后端 ``` uvicorn backend.main:app --reload ``` ## 打开 前端 ``` http://localhost:5500 ``` Swagger ``` http://127.0.0.1:8000/docs ``` Grafana ``` http://localhost:3001 ``` Prometheus ``` http://localhost:9090 ``` # API Endpoints | Endpoint | 描述 | |----------|-------------| | / | 首页 | | /health | 健康检查 | | /analyze | 分析事件 | | /incidents | 查看事件 | | /metrics | Prometheus 指标 | | /k8s-metrics | Kubernetes 指标 | # 未来改进 - Slack 告警 - Microsoft Teams 集成 - 邮件通知 - Kubernetes 自动修复 - Helm Chart 部署 - 多集群监控 - OpenAI 支持 - AWS EKS 支持 # 作者 **A Kishore Kumar** GitHub https://github.com/akishorekumar-1728 ⭐ 如果您喜欢这个项目,请给它点个 Star。
标签:AI运维, API集成, AV绕过, FastAPI, 可观测性, 大模型, 子域名突变, 自动化攻击, 自定义请求头, 请求拦截, 运维监控, 逆向工具