AI API¶
API endpoints for the AI assistant.
Chat¶
Send Message¶
Request Body:
Response:
{
"response": "Currently there are 47 pods running across 8 namespaces...",
"sources": ["kubernetes"],
"timestamp": "2024-01-15T10:30:00Z"
}
Example Queries¶
Kubernetes¶
{"message": "Show me all failed pods"}
{"message": "What's the CPU usage across nodes?"}
{"message": "List deployments in production namespace"}
Security¶
{"message": "What's my security score?"}
{"message": "Show critical vulnerabilities"}
{"message": "Are there privileged containers?"}
Health¶
Check AI Service Health¶
Response:
{
"status": "available",
"model": "gemini-1.5-flash",
"services": {
"kubernetes": "connected",
"security": "connected",
"jenkins": "disconnected",
"helm": "connected"
}
}
Query Types¶
The AI automatically detects and fetches data for:
| Type | Keywords |
|---|---|
| pods | pod, pods, running pods |
| deployments | deployment, replicas, rollout |
| services | service, svc, endpoints |
| nodes | node, worker, master |
| security | security, vulnerability, CVE |
| jenkins | build, pipeline, job |
| helm | chart, release, helm |
Rate Limiting¶
AI endpoints have stricter rate limits:
- 20 requests per minute per user
- 429 Too Many Requests when exceeded
Error Responses¶
Model Not Available¶
Invalid Request¶
Best Practices¶
- Be Specific - Include namespace or resource names
- Ask for Actions - Request kubectl commands
- Use Context - Provide additional context when helpful
- Follow Up - Ask clarifying questions