KubeNinja, an AI-powered tool that analyzes and fixes Kubernetes deployment issues based on logs and configurations.
KubeNinja leverages the llama3:latest
model from ollama
to diagnose and suggest fixes for Kubernetes deployment issues, ensuring that your Kubernetes environment is running smoothly.
- Analyzes Kubernetes deployment configurations and logs.
- Provides detailed explanations of issues and actionable commands to resolve them.
- Interactive prompt for user input and confirmations.
- Enhances user experience with modern, interactive UI using
gum
.
- Install
ollama
:- Download and install
ollama
from ollama's official website. - Ensure that
ollama
is running and accessible athttp://localhost:11434
. - Pull the
latest
version of thellama3
model with the following command:ollama pull llama3:latest
- Download and install
- Install
gum
(Optional for Enhanced UI/UX):- If you want to use the
gum
enhanced script:# macOS or Linux brew install gum # Arch Linux (btw) pacman -S gum # Windows (via WinGet or Scoop) winget install charmbracelet.gum scoop install charm-gum
- More installation methods here.
- If you want to use the
To cater to different user preferences and environments, we provide three versions of the script:
-
Bash Script without Dependencies (
script.sh
):- For users who prefer a bash script without any additional dependencies. This version has a basic user interface and functionality.
-
Bash Script with
gum
(gumscript.sh
):- For users who want a significantly enhanced user experience with a modern, interactive UI. This version requires the
gum
tool to be installed.
- For users who want a significantly enhanced user experience with a modern, interactive UI. This version requires the
You can choose the version that best fits your needs and preferences.
-
Clone the Repository:
git clone https://github.com/Osama-Yusuf/KubeNinja.git cd KubeNinja
-
Make the Script Executable:
chmod +x gumscript.sh
-
Install Dependencies:
- Ensure you have
jq
installed for processing JSON responses:sudo apt-get install jq
- Ensure you have
-
Add the Script to your bin directory:
sudo cp gumscript.sh /usr/local/bin/kubeninja
To analyze and fix Kubernetes deployment issues, run the script:
kubeninja mydeployment
- Prompt for the deployment name and optional issue description.
- Extract and analyze Kubernetes deployment configurations and logs.
- Call the AI model to generate explanations and actionable commands.
- Prompt the user to confirm or execute the suggested actions.
- Prompt for Deployment Name and Issue Description:
- The script prompts for the deployment name and an optional issue description.
- Extract Kubernetes Configurations and Logs:
- The script extracts relevant configurations and logs from the Kubernetes cluster.
- Generate Explanations and Actions:
- The script sends the extracted data to the AI model
llama3:latest
fromollama
to generate explanations and actionable commands.
- The script sends the extracted data to the AI model
- Interactive Confirmation:
- The script prompts you to confirm or execute the suggested actions.
Here is an example of how the AI-generated explanation and action might look:
INFO: The deployment is stuck due to a missing config map.
Act: kubectl create configmap my-config --from-literal=key1=value1
Contributions are welcome! Please fork the repository and create a pull request with your changes.
This project is licensed under the MIT License. See the LICENSE file for details.
For any inquiries or support, please contact Osama Yusuf.