Kubernetes MCP Usage Guide
When to Use
Use this skill when the user wants to operate Kubernetes through kubernetes-mcp:
- •connect MCP client to this server (
stdio,sse,streamable); - •discover resources, inspect cluster state, check logs/events/metrics;
- •troubleshoot failed tool calls and parameter mismatch.
Connection Checklist
- •Confirm server is reachable:
- •
stdio: binary command works with local kubeconfig. - •
streamable: endpoint isPOST /mcp.
- •
- •Confirm Kubernetes auth is valid:
- •explicit
--kubeconfigor in-cluster service account.
- •explicit
- •Prefer smallest-scope query first:
- •namespace + kind filters before wide cluster scans.
Recommended Tool Flow
- •Health and inventory:
- •
GET_CLUSTER_INFO - •
LIST_NAMESPACES
- •
- •Resource location:
- •
SEARCH_RESOURCES(supportsname=...,label=...,annotation=..., wildcard*) - •
LIST_K8S_RESOURCES
- •
- •Deep inspection:
- •
GET_K8S_RESOURCE/DESCRIBE_K8S_RESOURCE - •
GET_EVENTS
- •
- •Runtime diagnosis:
- •
GET_POD_LOGS - •
GET_POD_METRICS,GET_NODE_METRICS,GET_TOP_CONSUMERS
- •
Practical Query Patterns
- •Find all pods in namespace:
- •
SEARCH_RESOURCES {"kinds":"Pod","namespaces":"mcp-system","query":"name=*"}
- •
- •Find by label wildcard:
- •
SEARCH_RESOURCES {"query":"label=app:nginx-*","namespaces":"default"}
- •
- •Find by annotation:
- •
SEARCH_RESOURCES {"query":"annotation=team:platform","namespaces":"default"}
- •
- •List known kind explicitly:
- •
LIST_K8S_RESOURCES {"kind":"Pod","apiVersion":"v1","namespace":"default"}
- •
- •List namespace resources by discovery:
- •
LIST_K8S_RESOURCES {"namespace":"default"}
- •
Error Handling Guidance
- •If listing fails with missing
apiVersion:- •provide both
kindandapiVersion, or omitkindfor discovery listing.
- •provide both
- •If search returns empty unexpectedly:
- •check
kindsvalue (Pod/podsboth accepted), - •verify namespace scope,
- •test with
query:"name=*"first.
- •check
- •If metrics tools fail:
- •confirm metrics-server is installed and accessible.
Safety
- •Avoid destructive actions (
DELETE, large apply) unless user explicitly requests. - •For changes, prefer
VALIDATE_MANIFESTandDIFF_MANIFESTbeforeAPPLY_MANIFEST.