Spaces:
Build error
Build error
Murali Chandran commited on
Commit ·
321cdbf
1
Parent(s): 3b250b7
removed readme for testing
Browse files
README.md
CHANGED
|
@@ -1,213 +0,0 @@
|
|
| 1 |
-
# AgentCTL — LLM-Driven Kubernetes Automation
|
| 2 |
-
### Natural Language → Kubernetes Jobs, Deployments & CronJobs
|
| 3 |
-
Built for real clusters via Minikube + kubectl proxy + ngrok or Cloudflare Tunnel.
|
| 4 |
-
|
| 5 |
-
---
|
| 6 |
-
|
| 7 |
-
## 🚀 Overview
|
| 8 |
-
|
| 9 |
-
**AgentCTL** is an agentic workflow system that converts **natural language instructions** into **Kubernetes manifests** (Jobs, Deployments, CronJobs) and applies them to a **real Kubernetes cluster**.
|
| 10 |
-
|
| 11 |
-
It works by exposing your cluster via:
|
| 12 |
-
|
| 13 |
-
- `kubectl proxy`
|
| 14 |
-
- a public tunnel (`ngrok` or `cloudflared`)
|
| 15 |
-
- a Gradio web UI
|
| 16 |
-
- a lightweight NL → YAML agent (heuristic + optional OpenAI LLM)
|
| 17 |
-
|
| 18 |
-
---
|
| 19 |
-
|
| 20 |
-
## ✨ Features
|
| 21 |
-
|
| 22 |
-
- Natural language → Kubernetes YAML
|
| 23 |
-
- Supports:
|
| 24 |
-
- Jobs
|
| 25 |
-
- Deployments
|
| 26 |
-
- CronJobs
|
| 27 |
-
- Optional OpenAI LLM YAML refinement
|
| 28 |
-
- Cluster dashboard (Jobs, Pods, Deployments, CronJobs)
|
| 29 |
-
- Pod logs viewer
|
| 30 |
-
- Pure HTTP client — no kubeconfig required
|
| 31 |
-
|
| 32 |
-
---
|
| 33 |
-
|
| 34 |
-
## 🧱 Architecture
|
| 35 |
-
|
| 36 |
-
```
|
| 37 |
-
Gradio UI → AgentCTL (NL→YAML) → K8sClient (HTTP) → Kubernetes API
|
| 38 |
-
```
|
| 39 |
-
|
| 40 |
-
---
|
| 41 |
-
|
| 42 |
-
## 📦 Installation
|
| 43 |
-
|
| 44 |
-
```bash
|
| 45 |
-
pip install -r requirements.txt
|
| 46 |
-
```
|
| 47 |
-
|
| 48 |
-
or
|
| 49 |
-
|
| 50 |
-
```bash
|
| 51 |
-
conda create -n agentctl python=3.10 -y
|
| 52 |
-
conda activate agentctl
|
| 53 |
-
pip install -r requirements.txt
|
| 54 |
-
```
|
| 55 |
-
|
| 56 |
-
---
|
| 57 |
-
|
| 58 |
-
## 🧪 Minikube Setup
|
| 59 |
-
|
| 60 |
-
```bash
|
| 61 |
-
minikube start --driver=docker
|
| 62 |
-
kubectl get pods -A
|
| 63 |
-
```
|
| 64 |
-
|
| 65 |
-
Expose API publicly:
|
| 66 |
-
|
| 67 |
-
```bash
|
| 68 |
-
kubectl proxy --port=8001 --address=0.0.0.0 --accept-hosts='.*' --accept-paths='.*'
|
| 69 |
-
```
|
| 70 |
-
|
| 71 |
-
Tunnel:
|
| 72 |
-
|
| 73 |
-
```bash
|
| 74 |
-
ngrok http 8001
|
| 75 |
-
```
|
| 76 |
-
|
| 77 |
-
---
|
| 78 |
-
|
| 79 |
-
## 🌐 Environment Variables
|
| 80 |
-
|
| 81 |
-
```bash
|
| 82 |
-
export K8S_API_BASE_URL="https://xxxx.ngrok-free.dev"
|
| 83 |
-
export K8S_NAMESPACE="default"
|
| 84 |
-
export K8S_VERIFY_SSL=false
|
| 85 |
-
```
|
| 86 |
-
|
| 87 |
-
Enable LLM YAML:
|
| 88 |
-
|
| 89 |
-
```bash
|
| 90 |
-
export AGENTCTL_USE_LLM=true
|
| 91 |
-
export OPENAI_API_KEY="sk-..."
|
| 92 |
-
export OPENAI_MODEL="gpt-4o-mini"
|
| 93 |
-
```
|
| 94 |
-
|
| 95 |
-
---
|
| 96 |
-
|
| 97 |
-
## ▶️ Run the App
|
| 98 |
-
|
| 99 |
-
```bash
|
| 100 |
-
python app.py
|
| 101 |
-
```
|
| 102 |
-
|
| 103 |
-
Open:
|
| 104 |
-
|
| 105 |
-
```
|
| 106 |
-
http://localhost:7860
|
| 107 |
-
```
|
| 108 |
-
|
| 109 |
-
---
|
| 110 |
-
|
| 111 |
-
## 📝 Usage Examples
|
| 112 |
-
|
| 113 |
-
### 🟦 Job
|
| 114 |
-
```
|
| 115 |
-
run a python job to preprocess data
|
| 116 |
-
```
|
| 117 |
-
|
| 118 |
-
### 🟧 Deployment
|
| 119 |
-
```
|
| 120 |
-
Prompt
|
| 121 |
-
create an nginx deployment with 3 replicas
|
| 122 |
-
|
| 123 |
-
Example
|
| 124 |
-
**Generated YAML:**
|
| 125 |
-
|
| 126 |
-
```yaml
|
| 127 |
-
apiVersion: apps/v1
|
| 128 |
-
kind: Deployment
|
| 129 |
-
metadata:
|
| 130 |
-
name: nginx-deployment
|
| 131 |
-
namespace: default
|
| 132 |
-
labels:
|
| 133 |
-
app: agentctl-deployment
|
| 134 |
-
spec:
|
| 135 |
-
replicas: 3
|
| 136 |
-
selector:
|
| 137 |
-
matchLabels:
|
| 138 |
-
app: agentctl-deployment
|
| 139 |
-
template:
|
| 140 |
-
metadata:
|
| 141 |
-
labels:
|
| 142 |
-
app: agentctl-deployment
|
| 143 |
-
spec:
|
| 144 |
-
containers:
|
| 145 |
-
- name: main
|
| 146 |
-
image: nginx:1.27-alpine
|
| 147 |
-
ports:
|
| 148 |
-
- containerPort: 80
|
| 149 |
-
|
| 150 |
-
```
|
| 151 |
-
|
| 152 |
-
### 🟩 CronJob
|
| 153 |
-
```
|
| 154 |
-
Prompt
|
| 155 |
-
schedule a python cleanup script every 5 minutes
|
| 156 |
-
|
| 157 |
-
example
|
| 158 |
-
apiVersion: batch/v1
|
| 159 |
-
kind: CronJob
|
| 160 |
-
metadata:
|
| 161 |
-
name: agentctl-cronjob
|
| 162 |
-
namespace: default
|
| 163 |
-
spec:
|
| 164 |
-
schedule: "*/5 * * * *"
|
| 165 |
-
jobTemplate:
|
| 166 |
-
spec:
|
| 167 |
-
template:
|
| 168 |
-
metadata:
|
| 169 |
-
labels:
|
| 170 |
-
app: agentctl-cronjob
|
| 171 |
-
spec:
|
| 172 |
-
restartPolicy: Never
|
| 173 |
-
containers:
|
| 174 |
-
- name: main
|
| 175 |
-
image: python:3.11-slim
|
| 176 |
-
command:
|
| 177 |
-
- /bin/sh
|
| 178 |
-
- -c
|
| 179 |
-
- python cleanup.py
|
| 180 |
-
|
| 181 |
-
```
|
| 182 |
-
|
| 183 |
-
---
|
| 184 |
-
|
| 185 |
-
## 🚀 Deploy to Hugging Face Spaces
|
| 186 |
-
|
| 187 |
-
1. Create a Space (Gradio)
|
| 188 |
-
2. Upload project files
|
| 189 |
-
3. Set environment variables
|
| 190 |
-
4. Run the UI remotely controlling your real cluster
|
| 191 |
-
|
| 192 |
-
---
|
| 193 |
-
|
| 194 |
-
## 🔐 Security Notes
|
| 195 |
-
|
| 196 |
-
- ngrok + kubectl proxy is for demos only
|
| 197 |
-
- For real environments use:
|
| 198 |
-
- Cloudflare Tunnel
|
| 199 |
-
- RBAC service accounts
|
| 200 |
-
- Namespaced permissions
|
| 201 |
-
|
| 202 |
-
---
|
| 203 |
-
|
| 204 |
-
## ❤️ Credits
|
| 205 |
-
|
| 206 |
-
Built by **Murali Chandran (codeninja3d)**
|
| 207 |
-
AI Agents • Kubernetes • MLOps
|
| 208 |
-
|
| 209 |
-
---
|
| 210 |
-
|
| 211 |
-
## 📄 License
|
| 212 |
-
|
| 213 |
-
MIT License
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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