Kubernetes MCP Server
Connect your AI assistant to Kubernetes clusters for cluster management, pod inspection, deployment automation, and troubleshooting.
Kubernetes MCP Server
Connect your AI assistant directly to Kubernetes clusters for real-time cluster management and troubleshooting. The Kubernetes MCP server provides natural language interfaces for inspecting cluster resources, managing deployments, and diagnosing issues across your entire Kubernetes estate.
This server is invaluable for platform engineers managing multiple clusters, DevOps teams debugging production incidents, and developers who need quick access to Kubernetes resources without context-switching to kubectl.
What it Does
- Cluster Inspection: List nodes, namespaces, and cluster resources
- Pod Management: View pod status, logs, and descriptions
- Deployment Operations: Create, update, and scale deployments
- Service Management: Inspect and manage services, ingress, and networking
- Troubleshooting: Get events, describe resources, and diagnose issues
Installation
# Using npx
npx -y @anthropic-ai/mcp-server-kubernetes
# Using Docker
docker run -i --rm -v ~/.kube:/root/.kube mcp/kubernetes
Configuration
{
"mcpServers": {
"kubernetes": {
"command": "npx",
"args": ["-y", "@anthropic-ai/mcp-server-kubernetes"],
"env": {
"KUBECONFIG": "${HOME}/.kube/config"
}
}
}
}
Available Tools
| Tool | Purpose | Category |
|---|---|---|
list_nodes | List all nodes in the cluster | Cluster |
list_namespaces | List all namespaces | Cluster |
list_pods | List pods filtered by namespace and labels | Pods |
get_pod_logs | Fetch logs from a specific pod | Pods |
describe_pod | Get detailed pod description | Pods |
list_deployments | List deployments in a namespace | Deployments |
scale_deployment | Scale a deployment to a specific replica count | Deployments |
list_services | List all services | Networking |
get_events | Get cluster events for troubleshooting | Debugging |
Common Workflows
Investigating a Pod Crash Loop
- List pods in the affected namespace to identify the crashing pod
- Get the pod description to check recent events and status
- Fetch the logs from the crashing container
- Check cluster events for broader infrastructure issues
- Ask "What is causing this pod to crash loop based on the logs and events?"
Scaling for Traffic
- List deployments to find the target service
- Check current replica count and pod status
- Scale the deployment to handle increased load
- Monitor the new pods as they come online
- Verify service endpoints are routing to healthy pods
Cluster Health Check
- List all nodes and check their status
- Review cluster events for recent issues
- Check pod distribution across nodes
- Inspect any pending or failing pods
- Generate a cluster health summary
Example Prompts
- "Show me all pods in the default namespace"
- "What deployments are failing in production?"
- "Get logs from the api-server pod"
- "Scale the web deployment to 5 replicas"
- "List all services with external IPs"
- "Check events for the last hour across all namespaces"
Troubleshooting
| Issue | Likely Cause | Solution |
|---|---|---|
| "Connection refused" | Cluster not accessible from MCP host | Verify kubeconfig context and cluster endpoint reachability |
| "Unauthorized" | Kubeconfig lacks permissions | Use a service account token with appropriate RBAC bindings |
| "Pod not found" | Wrong namespace or pod name | Verify the namespace with list_namespaces first |
| "Context deadline exceeded" | Cluster is unreachable or overloaded | Check cluster health and network connectivity |
Security Notes
- Use read-only service accounts for production clusters
- Limit RBAC permissions to only required resources
- Never expose kubeconfig with admin credentials to AI assistants
Related Articles
Microsoft 365 MCP Server
Microsoft 365 MCP server provides unified access to Outlook mail, calendar, Teams, and files through the Microsoft Graph API for AI-powered productivity.
Slack MCP Server
Slack MCP server provides AI assistants with full Slack workspace integration including channel management, messaging, threads, reactions, and user presence.
Neon MCP Server
Neon MCP servers enable AI models to interact with serverless PostgreSQL databases, providing capabilities for structured data operations, SQL queries, database branching, and automatic scaling in a fully managed environment.