kubectl-ai

Terminal assistant that turns natural-language requests into kubectl and bash operations using Gemini, OpenAI, Bedrock, Ollama and other LLM providers.

install

kubectl-ai is a command-line assistant for Kubernetes that takes natural-language requests, such as "check logs for nginx app in hello namespace", and uses an LLM to suggest and run the matching Kubernetes operations. Its built-in tools are kubectl and bash. You can add custom tools through a tools.yaml file, which it reads from ~/.config/kubectl-ai/tools.yaml by default, or from a path given with --custom-tools-config.

It runs in an interactive chat mode that keeps context across questions, or in a non-interactive mode with --quiet and a task argument. It also reads stdin, so you can run cat error.log | kubectl-ai "explain the error", where the positional argument becomes a prefix to the piped content. Sessions can be saved and resumed with --new-session, --list-sessions, --resume-session and --delete-session. Settings can be given as command-line flags, in ~/.config/kubectl-ai/config.yaml, or as environment variables, and flags take precedence over the config file.

It supports several model providers: gemini (the default), vertexai, azopenai, openai, grok and bedrock. It also supports local models through ollama and llama.cpp, and OpenAI-compatible endpoints such as Alibaba's Qwen. For models that need special prompting for tool calling, there is an --enable-tool-use-shim flag. The README also documents an MCP server mode, an MCP client mode, a web UI option (uiType: web), and a Docker image that can be used against a GKE cluster. The tool is aimed at developers, platform engineers and SREs who work with Kubernetes clusters from the terminal.

Installation

# via Quick install script (Linux & macOS)
curl -sSL https://raw.githubusercontent.com/GoogleCloudPlatform/kubectl-ai/main/install.sh | bash
# via Krew
kubectl krew install ai
# via Nix
nix-shell -p kubectl-ai

kubectl-ai demo GIF using: kubectl-ai "how's nginx app doing in my cluster"

Alternatives & related tools

add a badge to your README

Maintain kubectl-ai? Show that it's featured on trmn. The badge links back to this page.

Featured on trmn
Markdown
[![Featured on trmn](https://www.trmn.sh/badge/kubectl-ai.svg)](https://www.trmn.sh/tools/kubectl-ai?utm_source=badge)
HTML
<a href="https://www.trmn.sh/tools/kubectl-ai?utm_source=badge"><img src="https://www.trmn.sh/badge/kubectl-ai.svg" alt="Featured on trmn" height="20"></a>