
reza-gholizade/k8s-mcp-server 是从 https://github.com/reza-gholizade/k8s-mcp-server. 导入的 MCP 服务器候选
概览
reza-gholizade/k8s-mcp-server 是从 https://github.com/reza-gholizade/k8s-mcp-server. 导入的 MCP 服务器候选
概述(AI 翻译)
一台 Kubernetes 模型上下文协议(MCP)服务器,通过标准化接口与 Kubernetes 集互。
托管部署
Fronteir AI 上提供了托管部署。
特色
- API 资源发现:获取 Kubernetes 集群中所有可用的 API 资源。
- 资源列表:列出任何类型的资源,带有可选命名空间和标签过滤功能。
- 资源详情:获取特定 Kubernetes 资源的详细信息。
- 资源描述:获取Kubernetes资源的全面描述,类似于
kubectl describe。 - Pod日志:从特定Pods获取日志(可选从特定容器,或未指定时所有容器)。
- 节点指标:获取特定节点的资源使用指标。
- Pod 指标:获取特定 Pods 的 CPU 和内存指标。
- 事件列表:列出命名空间内或特定资源的事件。
- 资源创建/更新:创建新的 Kubernetes 资源,或从 YAML 或 JSON 清单更新现有资源。
- 资源删除:它根据提供的命名空间和类型删除Kubernetes集群中的资源。
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
Kubernetes MCP Server
A Kubernetes Model Context Protocol (MCP) server that provides tools for interacting with Kubernetes clusters through a standardized interface.
Hosted deployment
A hosted deployment is available on Fronteir AI.
Features
- API Resource Discovery: Get all available API resources in your Kubernetes cluster.
- Resource Listing: List resources of any type with optional namespace and label filtering.
- Resource Details: Get detailed information about specific Kubernetes resources.
- Resource Description: Get comprehensive descriptions of Kubernetes resources, similar to
kubectl describe. - Pod Logs: Retrieve logs from specific pods (optionally from a specific container, or all containers if unspecified).
- Node Metrics: Get resource usage metrics for specific nodes.
- Pod Metrics: Get CPU and Memory metrics for specific pods.
- Event Listing: List events within a namespace or for a specific resource.
- Resource Creation/Updating: Create new Kubernetes resources or update existing ones from a YAML or JSON manifest.
- Resource Deletion: It deletes a resource in the Kubernetes cluster based on the provided namespace and kind.
- Standardized Interface: Uses the MCP protocol for consistent tool interaction.
- Flexible Configuration: Supports different Kubernetes contexts and resource scopes.
- Multiple Modes: Run in
stdiomode for CLI tools,ssemode, orstreamable-httpmode for web applications, and--readonlyfor no change in the cluster. - Security: Runs as non-root user in Docker containers for enhanced security.
Prerequisites
- Go 1.23 or later
- Access to a Kubernetes cluster
kubectlconfigured with appropriate cluster access
Installation
-
Clone the repository:
git clone https://github.com/reza-gholizade/k8s-mcp-server.git cd k8s-mcp-server -
Install dependencies:
go mod download -
Build the server:
go build -o k8s-mcp-server .
Usage
Starting the Server
The server can run in three modes, configurable via command-line flags or environment variables.
Stdio Mode (for CLI integrations)
This mode uses standard input/output for communication.
./k8s-mcp-server --mode stdio
Or using environment variables:
SERVER_MODE=stdio ./k8s-mcp-server
SSE Mode (for web applications)
This mode starts an HTTP server with Server-Sent Events support.
HTTP transports require a bearer token and listen on loopback by default:
MCP_AUTH_TOKEN="$(openssl rand -hex 32)" ./k8s-mcp-server --mode sse
Specify a port:
MCP_AUTH_TOKEN="your-random-secret" ./k8s-mcp-server --mode sse --port 9090
Or using environment variables:
SERVER_MODE=sse SERVER_PORT=9090 MCP_AUTH_TOKEN="your-random-secret" ./k8s-mcp-server
安装
docker run -p 8080:8080 -v ~/.kube/config:/home/appuser/.kube/config:ro ginnux/k8s-mcp-server:latest