This project is a Docker Desktop extension for KRS(Kubetools Recommender System) - a Gen-AI powered tool designed to recommend and manage tools for Kubernetes clusters. The extension provides a user-friendly interface for Kubernetes cluster operations such as initialization, scanning, recommendation, and healthcheck for tools, with support for different Kubernetes environments.
- Prerequisite
- Build and Install the Docker Extension
- Debug the Docker Extension
- Dockerfile Explanation
- User Interface (UI)
- Running the KRS Commands
- Handling Kubernetes Configurations
- Handling Other Kubernetes Contexts
Before you begin, ensure you have the following installed:
- Docker Desktop (for building and running Docker Desktop extensions)
- Node.js
- Go
- Python
Before you install the Krs Docker Extension, ensure that Kubernetes is enabled using Docker Desktop. Don't forget to select the "Show System containers" option under Docker Desktop > Settings > Kubernetes.
In the project root, run the following commands to build the extension:
$ make build-extension
You can install the built extension using Docker Desktop's command-line interface:
$ make install-extension
After installation, you will see the KRS - Kubetools Recommender System extension under Docker Desktop's Extensions tab.
Whenever you make a change to your extension, you only need to hit the following command. It will help you rebuild the extension and update it:
$ make update-extension
In the project root, run the following commands to debug the extension:
$ make debug-extension
You can turn off the debug mode by hitting this below command
$ make reset-extension
The Dockerfile is divided into three main stages:
- Base Image: golang:1.21-alpine
- This stage builds the backend service from the Go source files.
- Base Image: node:21.6-alpine
- This stage builds the frontend UI using Node.js.
- Base Image: python:3.12.5-alpine
- This stage sets up the KRS tool, installs required dependencies, and prepares the service to interact with Kubernetes.
The Docker extension provides a graphical user interface (GUI) that allows users to initialize the Kubernetes environment and run various KRS commands.
- React-based Frontend: The UI is built using React and Material-UI.
- Buttons so far:
krs init
: Initializes the services and loads the scanner. (WORKING) ✅krs scan
: Scans the cluster and extracts a list of tools that are currently used. (WORKING) ✅krs recommend
: Generates a table of recommended tools from our ranking database and their CNCF project status. (WORKING) ✅krs namespaces
: Lists all the namespaces. (WORKING) ✅krs pods
: Lists all the pods with namespaces, or lists pods under a specified namespace. (WORKING) ✅krs health
: Starts an interactive terminal using an LLM of your choice to detect and fix issues with your cluster. (WORKING) ✅krs export
: Exports pod info with logs and events. (WORKING) ✅krs exit
: Ends krs services safely and deletes all state files from system. Removes all cached data. (WORKING) ✅
This is the first step in starting your work with KRS. You will be asked to specify your local Kubernetes Configuration path. As a default, the path is ~/.kube/config
. You would not need to specify the path if you did not make any changes.
- Default:
~/.kube/config
- Other: The path to your Kubernetes Configuration file.
The krs
commands are executed inside a Docker container. This container is started in detached mode and can run commands via exec:
export const startKrsContainer = async (ddClient: v1.DockerDesktopClient) => {
// Start container in detached mode with kube config mounted
};
This command initializes the services and loads the scanner.
export const initKRS = async (ddClient: v1.DockerDesktopClient) => {
// Ensure the container is running, and execute "krs init" inside the container
};
This command scans the cluster and extracts a list of tools that are currently used.
export const krsScan = async (ddClient: v1.DockerDesktopClient) => {
// Ensure the container is running, and execute "krs scan" inside the container
};
This command scans the cluster and generates a table of recommended tools from our ranking database and their CNCF project status.
export const krsRecommend = async (ddClient: v1.DockerDesktopClient) => {
// Ensure the container is running, and execute "krs recommend" inside the container
};
This command lists all the namespaces.
export const krsNamespaces = async (ddClient: v1.DockerDesktopClient) => {
// Ensure the container is running, and execute "krs namespaces" inside the container
};
This command lists all the pods with namespaces, or lists pods under a specified namespace.
export const krsPods = async (ddClient: v1.DockerDesktopClient) => {
// Ensure the container is running, and execute "krs pods" inside the container
};
This command starts an interactive terminal using an LLM of your choice to detect and fix issues with your cluster.
export const krsHealth = async (ddClient: v1.DockerDesktopClient) => {
// Ensure the container is running, and execute "krs health" inside the container
};
This command will allow you to interact with your cluster.
This command exports pod info with logs and events.
export const krsExport = async (ddClient: v1.DockerDesktopClient) => {
// Ensure the container is running, and execute "krs export" inside the container
};
This command will export the pod information with logs and events inside the running container and copy it to your home directory.
This command ends krs services safely and deletes all state files from system. Removes all cached data.
export const krsExit = async (ddClient: v1.DockerDesktopClient) => {
// Ensure the container is running, and execute "krs exit" inside the container
};
The Docker extension dynamically handles various Kubernetes configurations by mounting the ~/.kube/config
file from the host system into the container. This file contains the necessary configurations to connect to the local Kubernetes clusters.
The KRS docker extension has been upgraded to support other k8s contexts besides docker-desktop
such as Minikube
and AWS EKS
.
The following guidelines are the steps to setup Minikube
:
- Ensure Minikube installed
- Start Minikube:
$ minikube start
- Ensure Minikube is running:
$ minikube status
- Select
Minikube
in a dropdown menu:
Whenever users select minikube context, the kube/config
file will be updated to have minikube
, it also requires some configurations for minikube which is located in the .minikube
folder. Additionally, the KRS docker extension requires that folder to be able to run the tool. As a default, the minikube
configuration path is ~/.minikube
, but the path might be different in other platforms such as Windows. Therefore, users can select the Other
button to specify it, otherwise, users can hit the Default
button.