About kubectl-ai
kubectl-ai is a kubectl plugin that generates and applies Kubernetes manifests using large language models (LLMs) via OpenAI, Azure OpenAI, or any OpenAI API-compatible endpoint (including local models via AIKit or LocalAI). It helps developers quickly create manifests for testing and development without manually collecting or writing YAML. The tool offers features such as confirmation prompts before applying, temperature control for creativity, and optional integration with the Kubernetes OpenAPI spec for more accurate completions. Installation is available via Homebrew, Krew, or direct binary download.
Key Features
Generate and apply Kubernetes manifests using LLMs (OpenAI GPT, Azure OpenAI, or any OpenAI-compatible endpoint)
Support for local LLM endpoints (e.g., AIKit, LocalAI) for offline usage
Optional integration with Kubernetes OpenAPI spec for more accurate and context-aware manifest generation
Confirmation prompt before applying manifests to prevent accidental changes
Adjustable temperature parameter to control creativity vs. determinism
Environment variable configuration for API keys, endpoints, and deployment models
Installable via Homebrew, Krew, or standalone binary
Works as a kubectl plugin or standalone CLI
Pros & Cons
Pros
- Saves time by generating manifests from natural language prompts
- Supports multiple LLM backends including local models for privacy and offline use
- Integrates with Kubernetes OpenAPI spec for improved accuracy
- Safe apply with mandatory confirmation prompt (default)
- Easy installation via multiple package managers
- Open source and free to use
Cons
- Requires a valid Kubernetes configuration and either an API key (OpenAI/Azure) or a local LLM endpoint setup
- Generated manifests may need manual validation and adjustment for production readiness
- Dependence on the quality and accuracy of the underlying LLM
- Limited to manifest generation; does not handle other kubectl operations
Best For
Rapid prototyping and testing Kubernetes resources without manually writing YAMLAutomating manifest generation for development and experimentationExploring LLM capabilities in infrastructure-as-code scenariosReducing time spent searching for and adapting example manifests
FAQ
What LLMs does kubectl-ai support?
kubectl-ai works with OpenAI GPT models via the OpenAI API, Azure OpenAI Service (with automatic character replacement in deployment names), and any OpenAI API-compatible endpoint such as AIKit or LocalAI for local models.
How do I install kubectl-ai?
You can install via Homebrew: 'brew tap sozercan/kubectl-ai' then 'brew install kubectl-ai'. Or via Krew: 'kubectl krew index add kubectl-ai https://github.com/sozercan/kubectl-ai' then 'kubectl krew install kubectl-ai/kubectl-ai'. Alternatively, download the binary from GitHub releases.
Can I use kubectl-ai without an internet connection?
Yes. You can set up a local OpenAI API-compatible endpoint using AIKit or LocalAI on your machine. Once the local endpoint is running, configure the environment variables OPENAI_ENDPOINT and OPENAI_DEPLOYMENT_NAME to point to your local service.