KGent is a smart Kubernetes CLI assistant powered by AI that helps you create, list, and delete Kubernetes resources using natural language. It acts as a bridge between your natural language input and the Kubernetes API.
- Natural Language Interface: Interact with your Kubernetes cluster using everyday language
- Resource Creation: Generate YAML files for Kubernetes resources based on your description
- Resource Management: List and delete resources through conversation
- AI-Powered: Uses large language models to understand requests and generate responses
- Go 1.21.3 or later
- Access to a Kubernetes cluster
- DashScope API token (or other compatible API token)
-
Clone the repository:
git clone https://github.com/your-username/kgent.git cd kgent -
Build the project:
go build -o kgent
-
Set up your environment:
Option 1: Using .env file (recommended)
Copy the example environment file and edit it with your credentials:
cp .env.example .env # Edit .env with your API keys and configurationOption 2: Using environment variables directly
export DASH_SCOPE_API_KEY=your_api_token_here # required export DASH_SCOPE_URL=https://dashscope.aliyuncs.com/compatible-mode/v1 export DASH_SCOPE_MODEL=qwen-turbo
Start a conversation with the Kubernetes assistant:
./kgent chatYou can specify a default namespace for all operations:
./kgent chat --namespace default-
Creating a pod:
> Create a pod named nginx-pod with nginx image -
Listing resources:
> List all pods in the default namespace -
Deleting a resource:
> Delete the pod named nginx-pod
You can configure KGent through either environment variables or a .env file:
| Environment Variable | Description | Default Value |
|---|---|---|
| DASH_SCOPE_API_KEY | DashScope API Key | (required) |
| DASH_SCOPE_URL | DashScope API URL | https://dashscope.aliyuncs.com/compatible-mode/v1 |
| DASH_SCOPE_MODEL | AI Model to use | qwen-max |
This project is licensed under the MIT License - see the LICENSE file for details.