Kubernetes Copilot
Project description
Kubernetes Copilot
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
Install the copilot with pip command below:
pip install kube-copilot
Setup
- 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 (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).
How to use
Running directly in the terminal:
Usage: kube-copilot [OPTIONS] COMMAND [ARGS]...
Kubernetes Copilot powered by OpenAI
Options:
--version Show the version and exit.
--help Show this message and exit.
Commands:
analyze analyze issues for a given resource
audit audit security issues for a Pod
diagnose diagnose problems for a Pod
execute execute operations based on prompt instructions
generate generate Kubernetes manifests
Running as container:
kubectl run -it --rm copilot \
--env="OPENAI_API_KEY=$OPENAI_API_KEY" \
--restart=Never \
--image=ghcr.io/feiskyer/kube-copilot \
-- execute --verbose 'What Pods are using max memory in the cluster'
Refer kubernetes.md for more detailed and fine-tuned steps.
Audit Security Issues for Pod
kube-copilot audit POD [NAMESPACE]
will audit security issues for a Pod:
Usage: kube-copilot audit [OPTIONS] POD [NAMESPACE]
audit security issues for a Pod
Options:
--verbose Enable verbose information of copilot execution steps
--model MODEL OpenAI model to use for copilot execution, default is gpt-4
--help Show this message and exit.
Diagnose Problems for Pod
kube-copilot diagnose POD [NAMESPACE]
will diagnose problems for a Pod:
Usage: kube-copilot diagnose [OPTIONS] POD [NAMESPACE]
diagnose problems for a Pod
Options:
--verbose Enable verbose information of copilot execution steps
--model MODEL OpenAI model to use for copilot execution, default is gpt-4
--help Show this message and exit.
Analyze Potential Issues for k8s Object
kube-copilot analyze RESOURCE NAME [NAMESPACE]
will analyze potential issues for the given resource object:
Usage: kube-copilot analyze [OPTIONS] RESOURCE NAME [NAMESPACE]
analyze issues for a given resource
Options:
--verbose Enable verbose information of copilot execution steps
--model TEXT OpenAI model to use for copilot execution, default is gpt-4
--help Show this message and exit.
Execute Operations Based on Prompt Instructions
kube-copilot execute INSTRUCTIONS
will execute operations based on prompt instructions.
It could also be used to ask any questions.
Usage: kube-copilot execute [OPTIONS] INSTRUCTIONS
execute operations based on prompt instructions
Options:
--verbose Enable verbose information of copilot execution steps
--model MODEL OpenAI model to use for copilot execution, default is gpt-4
--help Show this message and exit.
Generate Kubernetes Manifests
Use the kube-copilot generate
command to create Kubernetes manifests based on
the provided prompt instructions. After generating the manifests, you will be
prompted to confirm whether you want to apply them.
Usage: kube-copilot generate [OPTIONS] INSTRUCTIONS
generate Kubernetes manifests
Options:
--verbose Enable verbose information of copilot execution steps
--model TEXT OpenAI model to use for copilot execution, default is gpt-4
--help Show this message and exit.
Contribution
The project is opensource at github feiskyer/kube-copilot 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for kube_copilot-0.1.15-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | de09e7c5b8ba72860b369967753bad7a6fa1980e292063f40e3c1ad4477fa0d7 |
|
MD5 | a98eeb8faf0e98936768e5dda1aabea9 |
|
BLAKE2b-256 | 8a487df8debf56e0d0a03a5b1e18bc938bd666e64e6e459f0d41134d150ae615 |