Transform natural language descriptions into Kubernetes Custom Resource Definitions (CRDs) and OpenAPI specifications.
Generate Kubernetes APIs from plain English descriptions. This tool helps developers create Kubernetes Custom Resources by using AI to parse natural language requests and generate OpenAPI specs and CRD YAML files.
- Generate OpenAPI 3.0 specifications from natural language descriptions
- Create Kubernetes Custom Resource Definitions (CRDs)
- Produce sample Kubernetes YAML files for testing
- Command-line interface with demo examples
- Kind cluster integration for testing deployments
- Python 3.8+
- Docker (running)
- curl (usually pre-installed)
- OpenRouter API key (free tier available)
Note: kubectl and kind are installed automatically by the demo script.
# Clone the repository
git clone https://github.com/marcuspat/AI-Kubernetes-API-Generator-Demo.git
cd AI-Kubernetes-API-Generator-Demo
# Get your free OpenRouter API key from https://openrouter.ai
export OPENROUTER_API_KEY="your-openrouter-api-key-here"
# Run the complete demo
./run.sh demo
The demo command automatically:
- Installs kubectl and kind CLI tools
- Creates Kind cluster if needed
- Generates Kubernetes APIs from natural language
- Deploys CRDs and sample instances to the cluster
- Shows running resources
If you prefer to install tools manually:
# Install kubectl and kind manually, then:
kind create cluster --name ai-platform-demo
# Run just the AI demo (no automatic setup)
python examples/ai_demo.py
# Deploy generated resources manually
kubectl apply -f generated_specs/kubernetes/databaseservice-crd.yaml
kubectl apply -f generated_specs/kubernetes/databaseservice-instance.yaml
After the demo completes, explore your new Kubernetes APIs:
# Check deployed custom resources
kubectl get crds | grep cnoe.io
# View your new API instances
kubectl get databaseservices.database.cnoe.io
kubectl describe databaseservice my-databaseservice-instance
# Explore the cluster
kubectl get all -A
Describe what you want to create in plain English:
- "PostgreSQL database clusters with replication and backup scheduling"
- "Redis cluster management with memory and CPU configuration"
- "Monitoring service API with configurable intervals and alerts"
The AI generates these files:
generated_specs/database_demo.json
- OpenAPI 3.0 specificationgenerated_specs/kubernetes/databaseservice-crd.yaml
- Kubernetes CRDgenerated_specs/kubernetes/databaseservice-instance.yaml
- Sample instance
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: databaseservices.database.cnoe.io
spec:
group: database.cnoe.io
versions:
- name: v1alpha1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
connectionString:
type: string
description: Database connection string
backupSchedule:
type: string
description: Cron schedule for backups
autoScaling:
type: boolean
description: Enable auto-scaling
# Run tests
python3 -m pytest tests/ -v
Required environment variables:
export OPENROUTER_API_KEY="your-openrouter-api-key"
export OPENROUTER_MODEL="meta-llama/llama-3.2-3b-instruct:free"
Get your free API key from OpenRouter.ai
- Describe API: Explain what you want in natural language
- AI Processing: The AI parses your description into a structured request
- Generate Spec: Creates OpenAPI 3.0 specification from the parsed request
- Deploy CRD: Apply generated Kubernetes YAML to your cluster
- Use Resource: Interact with your new custom resource
Example deployment:
kubectl apply -f generated_specs/kubernetes/databaseservice-crd.yaml
kubectl get databaseservices.database.cnoe.io
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
MIT License - see LICENSE file for details.
Built with Pydantic and follows OpenAPI 3.0 standards.