Skip to content

avsthiago/kopylot

Repository files navigation

KoPylot: Your AI-Powered Kubernetes Assistant ๐Ÿค–

Release Build status codecov Commit activity License

KoPylot is an open-source AI-powered Kubernetes assistant. Its goal is to help developers and DevOps engineers to easily manage and monitor their Kubernetes clusters.

You can read more about the project in the blog post.

๐Ÿ’ซ Features:

  • ๐Ÿ” Audit: Audit a resource, such as pods, deployments, or services using an LLM model. Audit

  • ๐Ÿฉบ Diagnose: Diagnose resources, such as pods, deployments, or services using an LLM model. Diagnose

  • ๐Ÿ’ฌ Chat: Start a chat with KoPylot to generate kubectl commands based on your prompts. Chat

  • โ˜ธ๏ธ Ctl: A wrapper around kubectl. The arguments passed to the ctl subcommand are interpreted by kubectl. Ctl

๐Ÿš€ Quick Start:

  1. Requests an API key from OpenAI.
  2. Export the key using the following command:
export KOPYLOT_AUTH_TOKEN=your_api_key

NOTE: If you want to avoid having the key in your .bashrc, .oh-my-zsh/custom dir, or your .bash_history or .zsh_history, a possible trick is to do something like this:

export KOPYLOT_AUTH_TOKEN=$(cat ../../../keys/openai)
  1. Install KoPylot using pip:
pip install kopylot
  1. Run KoPylot:
kopylot --help

๐Ÿ“– Usage:

Usage: kopylot [OPTIONS] COMMAND [ARGS]...                                           
                                                                                      
โ•ญโ”€ Options โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ --version                                                                          โ”‚
โ”‚ --install-completion        [bash|zsh|fish|powershell  Install completion for the  โ”‚
โ”‚                             |pwsh]                     specified shell.            โ”‚
โ”‚                                                        [default: None]             โ”‚
โ”‚ --show-completion           [bash|zsh|fish|powershell  Show completion for the     โ”‚
โ”‚                             |pwsh]                     specified shell, to copy it โ”‚
โ”‚                                                        or customize the            โ”‚
โ”‚                                                        installation.               โ”‚
โ”‚                                                        [default: None]             โ”‚
โ”‚ --help                                                 Show this message and exit. โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
โ•ญโ”€ Commands โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ audit     Audit a pod, deployment, or service using an LLM model.                  โ”‚
โ”‚ chat      Start a chat with kopylot to generate kubectl commands based your        โ”‚
โ”‚           inputs.                                                                  โ”‚
โ”‚ ctl       A wrapper around kubectl. The arguments passed to the ctl subcommand are โ”‚
โ”‚           interpreted by kubectl.                                                  โ”‚
โ”‚ diagnose  Diagnose a resource e.g. pod, deployment, or service using an LLM model. โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

๐Ÿค Contributions:

KoPylot is an open-source project and we welcome contributions from the community. There are a couple of ways to set up your development environment and start contributing to the project.

๐Ÿณ Using a Dev Container

KoPylot supports development using a dev container, which helps you set up a consistent and isolated environment for development. This makes it easy to get started without having to worry about conflicting dependencies or configurations on your local machine.

To get started with a dev container:

  1. Install Docker and Visual Studio Code.
  2. Install the Remote - Containers extension in Visual Studio Code.
  3. Clone the KoPylot repository and open the project folder in Visual Studio Code.
  4. Press F1, type Remote-Containers: Reopen in Container, and hit Enter. Visual Studio Code will build the dev container and reopen the project inside it.

You're now ready to start contributing to KoPylot using the dev container!

๐Ÿ› ๏ธ Local Setup

If you prefer to set up your development environment locally, make sure you have Poetry installed on your system. Then, follow these steps:

  1. Clone the KoPylot repository:

    git clone https://github.com/avsthiago/kopylot
  2. Navigate to the project folder:

    cd kopylot
  3. Install the project dependencies using Poetry:

    make install

You're now ready to start contributing to KoPylot using your local setup! ๐Ÿ˜„

Before submitting a pull request, please make sure to test your changes and follow the project's coding guidelines. We appreciate your contributions and look forward to collaborating with you! ๐ŸŽ‰

๐Ÿ“„ License:

KoPylot is licensed under the MIT License. See LICENSE for more information.

โ˜Ž๏ธ Contact:

If you have any questions or suggestions, feel free to contact me on https://thiagoalves.ai.

Thank you for using KoPylot! ๐Ÿ™Œ

๐Ÿ—บ๏ธ Roadmap:

  • Wrap the kubectl command using ctl subcommand.
  • Create the audit subcommand to audit kubernetes resources.
  • Create the diagnose subcommand to diagnose kubernetes resources.
  • Create the chat subcommand to generate kubectl commands using from the user prompts.
  • Make it possible to use other LLM models, not just from OpenAI.
  • Integrate LangChain into KoPylot to make it as autonomous as possible.

~ Similar Projects:

One of the similar projects that I found is the Kopilot from knight42. It is also a Kubernetes assistant which uses LLMs behind the scenes. The main difference from KoPylot is that it is written in Go. At the moment, it doesn't have the Chat command implemented, but it can respond in different languages.