explaingit

googlecloudplatform/kubectl-ai

7,455GoAudience · ops devopsComplexity · 3/5LicenseSetup · moderate

TLDR

A command-line tool that lets you manage Kubernetes clusters using plain English questions and instructions instead of memorizing kubectl commands and YAML syntax.

Mindmap

mindmap
  root((kubectl-ai))
    What it does
      Natural language kubectl
      Cluster management
      Error diagnosis
    AI Models
      Gemini default
      OpenAI
      Claude via Bedrock
      Local Ollama
    Usage modes
      Interactive chat
      One-liner command
      Piped input
    Install
      Shell script
      Krew plugin
      Nix
    Integration
      MCP server
      kubectl plugin
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Ask what pods are running in a cluster in plain English instead of writing kubectl commands

USE CASE 2

Paste a Kubernetes error log and ask for a plain-English explanation and suggested fix

USE CASE 3

Use conversational sessions to iteratively troubleshoot and reconfigure a Kubernetes cluster

Tech stack

GoKubernetesGeminiOpenAIOllama

Getting it running

Difficulty · moderate Time to first run · 30min

Requires a running Kubernetes cluster and an API key for your chosen AI provider (Gemini, OpenAI, etc.).

Open source under Apache 2.0, use freely in commercial projects as long as you keep the copyright notice.

In plain English

kubectl-ai is a command-line tool from Google that lets you manage a Kubernetes cluster by typing natural-language questions and instructions instead of having to know the exact kubectl commands. Kubernetes is a system for running and coordinating software applications across many servers. Managing it normally requires learning specific commands and YAML configuration files, which can be complex. kubectl-ai acts as an interpreter: you describe what you want in plain English, and it figures out the right operations to perform. The tool supports a range of AI models. By default it uses Google's Gemini model, but you can configure it to use OpenAI's models, Grok from xAI, Claude models through Amazon's Bedrock service, or AI models running locally on your own computer through Ollama or llama.cpp. You connect the tool to whichever AI provider you prefer by setting an API key as an environment variable. You can use it interactively, typing questions one after another in a conversational session, or run it as a one-liner by passing your question directly on the command line. It also accepts piped input, so you could, for example, paste an error log into it and ask for an explanation. Sessions can be saved to disk and resumed later, preserving the context from a previous conversation. The tool integrates with the standard Kubernetes command-line interface and can be installed as a plugin that runs as "kubectl ai". Installation is available through a shell script, manual download, or package managers including Krew (the Kubernetes plugin manager) and Nix. It can also run as an MCP server, which allows other AI tools to use it as a backend for Kubernetes operations. The project is published under the Google Cloud Platform organization on GitHub and is written in Go.

Copy-paste prompts

Prompt 1
Using kubectl-ai, how do I find all pods in my cluster that are crashing and get a plain-English summary of why?
Prompt 2
How do I set up kubectl-ai with a local Ollama model so I can manage my Kubernetes cluster without a paid API key?
Prompt 3
Show me how to pipe a Kubernetes error log into kubectl-ai and ask it to diagnose and suggest a fix
Prompt 4
How do I save and resume a kubectl-ai session so I can continue troubleshooting where I left off?
Open on GitHub → Explain another repo

← googlecloudplatform on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.