What is Kubernetes MCP Server?
Kubernetes MCP Server is a Model Context Protocol (MCP) server that provides tools for interacting with Kubernetes clusters through a standardized interface. It is designed for developers and operators who need to manage Kubernetes resources, retrieve logs and metrics, and perform Helm operations programmatically via CLI, web applications, or AI assistants.
How to use Kubernetes MCP Server?
Clone the repository, install dependencies with go mod download, build with go build -o k8s-mcp-server main.go, then run the server in one of three modes: stdio, sse, or streamable-http. Authentication can be configured via kubeconfig file, environment variables (KUBECONFIG_DATA, KUBERNETES_SERVER/TOKEN), or in-cluster service account. A Docker image is available on Docker Hub (ginnux/k8s-mcp-server:latest). The server can also be run in read-only mode (--read-only) or with tool categories selectively disabled (--no-k8s, --no-helm).
Key features of Kubernetes MCP Server
- API Resource Discovery: get all available API resources in the cluster
- Resource Listing: list resources with optional namespace and label filtering
- Resource Details: get detailed information about specific resources
- Pod Logs: retrieve logs from specific pods or containers
- Node and Pod Metrics: get CPU/Memory usage metrics
- Event Listing: list events within a namespace or for a resource
- Resource Creation/Updating/Deletion from YAML or JSON manifests
- Helm tool support: install, upgrade, uninstall, rollback, and list Helm releases
- Multiple transport modes: stdio, SSE, and streamable-http
- Read-only mode disables all write operations for safe exploration
- Runs as non-root user in Docker containers
Use cases of Kubernetes MCP Server
- Query and inspect Kubernetes resources (pods, deployments, services) via AI assistants
- Monitor cluster health by retrieving pod logs, node/pod metrics, and events
- Automate resource creation, updates, and deletions with YAML/JSON manifests
- Perform Helm chart lifecycle operations (install, upgrade, uninstall, rollback)
- Enable safe, read-only exploration of a cluster for auditing or debugging
评论