kubectl-ai

An AI assistant for Kubernetes that turns plain-language requests into kubectl operations and doubles as an MCP server

CLIEditors’ pickHigh risk

googlecloudplatform/kubectl-ai

Install

curl -sSL https://raw.githubusercontent.com/GoogleCloudPlatform/kubectl-ai/main/install.sh | bash

Linux and macOS; kubectl must be configured.

This is third-party code. Review the repository files before installing.

What it does

kubectl-ai takes a request like "how is nginx doing in my cluster", runs the needed kubectl commands, reads the output and answers. It works interactively or in quiet mode for scripts, and also installs as the kubectl ai plugin. It supports Gemini, Vertex AI, OpenAI, Azure OpenAI, Grok, Bedrock and local models via Ollama and llama.cpp. With --mcp-server it exposes its kubectl tools to other MCP clients, and with --external-tools it also proxies tools from other MCP servers.

Who it is for. For DevOps engineers and developers who operate Kubernetes clusters.

Good fit when

  • You need a quick read on cluster state without typing command after command
  • You want to give Claude or Cursor kubectl access via MCP
  • You need a Kubernetes assistant on a local model

Not a fit when

  • kubectl and cluster access are not configured
  • The model must not get write access to a production cluster

Example request

Check the logs of the nginx app in the hello namespace and tell me why pods keep restarting

Limitations

kubectl must be installed and configured. The CLI needs a model provider key, Gemini by default, which is not reachable from Russia without a VPN; local models via Ollama work. The HTTP MCP mode has no auth by default: anyone who reaches the port can run kubectl and bash, so enable OAuth 2.1 for non-local access.

How to disable. Remove the kubectl-ai binary from PATH or run kubectl krew uninstall ai, and delete the kubectl-ai block from the MCP config.

Security check

  • Runs kubectl and bash commands against the cluster
  • Can modify resources, production included

README in short

The README covers installation via script, manually, via krew and Nix, and setup for various model providers. It explains the config file, built-in tools, Docker usage and MCP client mode. A separate section covers MCP server mode, HTTP transport and OAuth 2.1 auth. Apache-2.0 licensed.

FAQ

Does MCP server mode need a model key?

In basic mode the server exposes kubectl tools to the client, and the client's own model does the reasoning.

Can it run without the cloud?

Yes, via --llm-provider ollama or llama.cpp.

Editors’ pick

An MCP server built into the Netdata agent: metrics, logs, alerts and live process, service and container data for an AI assistant

MCP serverMedium risk80.5K
Editors’ pick

GitHub's official MCP server: code, issues, pull requests, Actions and security alerts straight from the agent

MCP serverHigh risk32.9K
Editors’ pick

AWS's official MCP server suite: docs, IaC, containers, serverless, databases, cost and monitoring

MCP serverHigh risk9.7K
Editors’ pick

A GitHub Action that runs Claude Code in pull requests and issues: answers mentions, reviews and makes changes

PluginHigh risk8.9K