Kubernetes MCP Server
Provides tools for generating Kubernetes YAML manifests (Deployments, Services, ConfigMaps, Secrets, Ingresses, Namespaces) and performing kubectl operations (apply, delete, get, describe, logs, exec) on Kubernetes clusters.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Kubernetes MCP ServerCreate a deployment for nginx with 3 replicas"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Kubernetes MCP Server
An MCP server that provides tools for generating Kubernetes YAML manifests and deploying using kubectl.
Features
Manifest Generation
generate_deployment: Create Deployment manifests with resource limits, env vars
generate_service: Create Service manifests (ClusterIP, NodePort, LoadBalancer)
generate_configmap: Create ConfigMap manifests
generate_secret: Create Secret manifests (auto base64 encoding)
generate_ingress: Create Ingress manifests with optional TLS
generate_namespace: Create Namespace manifests
Kubectl Operations
kubectl_apply: Apply manifests to cluster
kubectl_delete: Delete resources from cluster
kubectl_get: List resources
kubectl_describe: Describe resources in detail
kubectl_logs: Get pod logs
kubectl_exec: Execute commands in pods
Related MCP server: kubernetes-mcp-server
Prerequisites
Python 3.10+
kubectl installed and configured
Access to a Kubernetes cluster (kubeconfig set up)
Installation
cd kubernetes-mcp-server
pip install -r requirements.txtKubernetes Access
Ensure kubectl is configured:
# Verify connection
kubectl cluster-info
# Check current context
kubectl config current-context
# List available contexts
kubectl config get-contextsConfiguration
Add to your Claude Code settings (~/.claude/settings.json):
{
"mcpServers": {
"kubernetes": {
"command": "python",
"args": ["/Users/youruser/Documents/Base/DevOps-ClaudeAi/test-cases/SM1/my-first-vpc/kubernetes-mcp-server/server.py"]
}
}
}Usage Examples
Generate Manifests
User: "Generate a deployment for nginx with 3 replicas"
Claude: [calls generate_deployment with name=nginx, image=nginx:latest, replicas=3]
User: "Create a LoadBalancer service for the nginx deployment"
Claude: [calls generate_service with service_type=LoadBalancer, selector={app: nginx}]
User: "Generate a configmap with database connection settings"
Claude: [calls generate_configmap with data]Deploy to Cluster
User: "Apply the nginx deployment to the cluster"
Claude: [calls kubectl_apply with manifest path]
User: "Get all pods in the default namespace"
Claude: [calls kubectl_get with resource_type=pods, namespace=default]
User: "Show me the logs from the nginx pod"
Claude: [calls kubectl_logs with pod_name]Manifest Storage
Generated manifests are automatically saved to ~/k8s-manifests/ with timestamps:
deployment-nginx_20260417_143022.yamlservice-nginx_20260417_143045.yaml
This allows you to:
Track generated configurations
Version control your manifests
Re-apply manifests later
Review what was created
Security Notes
⚠️ IMPORTANT:
This server can deploy resources to your Kubernetes cluster
Always review generated manifests before applying
Use RBAC to limit kubectl permissions
Be cautious with kubectl_exec (can run arbitrary commands in pods)
Secrets are base64 encoded (not encrypted) - use proper secret management solutions
Recommended RBAC Policy
Create a ServiceAccount with limited permissions:
apiVersion: v1
kind: ServiceAccount
metadata:
name: mcp-deployer
namespace: default
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: mcp-deployer-role
namespace: default
rules:
- apiGroups: ["", "apps", "networking.k8s.io"]
resources: ["deployments", "services", "configmaps", "secrets", "ingresses"]
verbs: ["get", "list", "create", "update", "patch"]
- apiGroups: [""]
resources: ["pods", "pods/log"]
verbs: ["get", "list"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: mcp-deployer-binding
namespace: default
subjects:
- kind: ServiceAccount
name: mcp-deployer
roleRef:
kind: Role
name: mcp-deployer-role
apiGroup: rbac.authorization.k8s.ioWorking with Multiple Clusters
Use the context parameter to target different clusters:
User: "Deploy to production cluster"
Claude: [calls kubectl_apply with context=prod-cluster]
User: "List pods in staging"
Claude: [calls kubectl_get with context=staging-cluster]Error Handling
The server provides detailed kubectl error messages:
Resource already exists
Permission denied (RBAC)
Invalid manifest syntax
Connection errors
Resource not found
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/dkeeno/kubernetes-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server