Kubernetes Copilot powered by OpenAI.
Features:
- Automate Kubernetes cluster operations using ChatGPT (GPT-4 or GPT-3.5).
- Diagnose and analyze the potential issues for Kubernetes workloads.
- Generate the Kubernetes manifests based on the provided prompt instructions.
- Utilize native kubectl and trivy commands for Kubernetes cluster access and security vulnerability scanning.
- Access the web and perform Google searches without leaving the terminal.
Install the copilot with the commands below:
go install github.com/feiskyer/kube-copilot/cmd/kube-copilot@latest
Setup the following environment variables:
- Ensure
kubectl
is installed on the local machine and the kubeconfig file is configured for Kubernetes cluster access. - Install
trivy
to assess container image security issues (only required for theaudit
command). - Set the OpenAI API key as the
OPENAI_API_KEY
environment variable to enable ChatGPT functionality.- For Azure OpenAI service, also set
OPENAI_API_TYPE=azure
andOPENAI_API_BASE=https://<replace-this>.openai.azure.com/
.
- For Azure OpenAI service, also set
- Google search is disabled by default. To enable it, set
GOOGLE_API_KEY
andGOOGLE_CSE_ID
(obtain from here and here).
Then run the following commands directly in the terminal:
Kubernetes Copilot powered by OpenAI
Usage:
kube-copilot [command]
Available Commands:
analyze Analyze issues for a given resource
audit Audit security issues for a Pod
completion Generate the autocompletion script for the specified shell
diagnose Diagnose problems for a Pod
execute Execute operations based on prompt instructions
generate Generate Kubernetes manifests
help Help about any command
Flags:
-c, --count-tokens Print tokens count
-h, --help help for kube-copilot
-t, --max-tokens int Max tokens for the GPT model (default 1024)
-m, --model string OpenAI model to use (default "gpt-4")
-v, --verbose Enable verbose output (default true)
Use "kube-copilot [command] --help" for more information about a command.
Please refer feiskyer/kube-copilot-python for the Python implementation of the same project.
The project is opensource at github feiskyer/kube-copilot (Go) and feiskyer/kube-copilot-python (Python) with Apache License.
If you would like to contribute to the project, please follow these guidelines:
- Fork the repository and clone it to your local machine.
- Create a new branch for your changes.
- Make your changes and commit them with a descriptive commit message.
- Push your changes to your forked repository.
- Open a pull request to the main repository.