首页 公告 项目 RSS

⬇️⬇️⬇️ 欢迎关注我的 telegram 频道和 twitter ⬇️⬇️⬇️


联系方式: Twitter Github Email Telegram

Manage Your Kubernetes Cluster with kubectl-ai

July 3, 2025 本文有 213 个字 需要花费 1 分钟阅读

Introduction

The biggest advantage of kubectl-ai is that when an alert occurs in your cluster, you can use it directly to analyze the cause. If you have the capability and budget, you can even integrate kubectl-ai into your alerting system to achieve automated analysis and response.

What is kubectl-ai

kubectl-ai is an AI assistant plugin designed for Kubernetes users. It can convert natural language (such as Chinese or English) into kubectl commands, helping users manage and operate Kubernetes clusters more efficiently. By integrating AI capabilities, kubectl-ai can understand user intent, automatically generate, interpret, or optimize kubectl commands, lowering the barrier to using Kubernetes and improving both operations and development efficiency.

Project Address

https://github.com/GoogleCloudPlatform/kubectl-ai

Usage

First, install the plugin:

kubectl krew install ai

My backend uses one-hub:

https://github.com/MartialBE/one-hub

Set environment variables and start:

export OPENAI_API_KEY=xxxx && \
export OPENAI_ENDPOINT=https://xxxx.xxxx.xxx/v1 && \
kubectl-ai --llm-provider=openai --model=xxx

You can ask questions directly in natural language, for example:

  Hey there, what can I help you with today?

>>> How many nodes are in the cluster?
  Running: kubectl get nodes

  There are 33 nodes in the current cluster.

kubectl-ai also supports a simple web interface:

kubectl ai --llm-provider=openai --model=gpt-4.1 --user-interface html

Of course, MCP server mode is also supported:

kubectl ai --llm-provider=openai --model=gpt-4.1 --mcp-server

Welcome to follow my blog: