k8m is a lightweight console tool that integrates AI and Kubernetes, designed to simplify cluster management. Built on AMIS and using kom as the Kubernetes API client, k8m comes with built-in interaction capabilities powered by the Qwen2.5-Coder-7B model and supports integration with your private AI models.
The design philosophy of k8m is "lightweight and efficient, simplifying complexity." It helps developers and operators quickly get started and effortlessly manage Kubernetes clusters.
./k8m command and visit http://127.0.0.1:3618../k8m -h --add_dir_header If true, adds the file directory to the header of the log messages --alsologtostderr log to standard error as well as files (no effect when -logtostderr=true) -k, --chatgpt-key string API Key for ChatGPT (default "sk-XXXX") -u, --chatgpt-url string API URL for ChatGPT (default "https://api.siliconflow.cn/v1") -d, --debug Debug mode, same as GIN_MODE -c, --kubeconfig string Absolute path to the kubeConfig file (default "/Users/xxx/.kube/config") --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory (no effect when -logtostderr=true) --log_file string If non-empty, use this log file (no effect when -logtostderr=true) --log_file_max_size uint Defines the maximum size a log file can grow to (no effect when -logtostderr=true). Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800) --logtostderr log to standard error instead of files (default true) --one_output If true, only write logs to their native severity level (vs also writing to each lower severity level; no effect when -logtostderr=true) -p, --port int Port for the server to listen on (default 3618) --skip_headers If true, avoid header prefixes in the log messages --skip_log_headers If true, avoid headers when opening log files (no effect when -logtostderr=true) --stderrthreshold severity logs at or above this threshold go to stderr when writing to files and stderr (no effect when -logtostderr=true or -alsologtostderr=true) (default 2) -v, --v Level number for the log level verbosity (default 0) --vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
Starting from version v0.0.8, GPT is built-in and does not require configuration. If you need to use your own GPT, please refer to the steps below.
Set the environment variables to enable ChatGPT.
export OPENAI_API_KEY="sk-XXXXX"
export OPENAI_API_URL="https://api.siliconflow.cn/v1"
This project integrates the github.com/sashabaranov/go-openai SDK. For users in China, it's recommended to use the Silicon Flow service. After logging in, create an API_KEY at https://cloud.siliconflow.cn/account/ak.
The Makefile in this project is used to automate common tasks such as building, testing, and cleaning the project. Below is a detailed usage guide to help you understand how to use the targets defined in the Makefile.
Before using the Makefile, ensure that the following tools are installed on your system:
make
make build
bin/ directory with the filename k8m (or k8m.exe for Windows).make build-all
bin/ directory, named as k8m-<GOOS>-<GOARCH> (e.g., k8m-linux-amd64, k8m-windows-amd64.exe).bin/ directory and all compiled executables.make clean
bin/ directory and its contents will be deleted.make run
make help
The build-all target supports cross-compiling for the following OS and architecture combinations:
amd64arm64ppc64les390xmips64leriscv64amd64arm64amd64arm64Build the k8m executable for the current OS and architecture:
make build
Cross-compile k8m for all specified platforms and architectures:
make build-all
On Unix systems, build and run k8m:
make run
Remove all compiled executables and the bin/ directory:
make clean
Display all available Makefile targets and their descriptions:
make help
VERSION variable:
make build VERSION=v2.0.0
.exe extension to the executable.GIT_COMMIT hash.make, go), ensure that all prerequisites are installed and correctly configured in your system's PATH.make run, ensure that the bin/ directory and the compiled binary have the necessary execution permissions:
chmod +x bin/k8m






k8m offers integrated YAML browsing, editing, and documentation features with automatic YAML attribute translation. Whether you're looking up field definitions or verifying configuration details, you can skip the tedious searches, significantly boosting your efficiency.


In the Event page, k8m comes with built-in AI diagnostic capabilities to intelligently analyze abnormal events and provide detailed explanations. By clicking the "AI Brain" button next to an event, you can view the diagnostic results within moments and quickly pinpoint the root cause of issues.

Log analysis is a crucial step in troubleshooting, but large volumes of error messages can make it challenging to identify issues efficiently. k8m supports AI-powered log diagnostics to quickly detect critical errors and generate actionable suggestions. Simply select the relevant log entries, click the AI diagnostic button, and receive a comprehensive report.

Command operations within Pods are an inevitable part of daily maintenance. With AI assistance, you only need to describe your requirements, and k8m will automatically generate suitable commands for your reference, saving time and improving efficiency.

If you have any further questions or need additional assistance, feel free to reach out!