Kubernetes
Run the Kubernetes MCP server in your cluster, read-only, so the agent can read pods, logs, events and resources.
The Kubernetes MCP server talks to the Kubernetes API directly. With it, the agent can list pods, read their logs, follow events and inspect any resource, in any Kubernetes cluster (EKS, GKE, AKS, OpenShift, on-prem). For AWS-specific views (CloudWatch, EKS insights), see also Amazon EKS.
| Setting | Value |
|---|---|
| Runs | In your cluster (Helm chart or a Deployment) |
| Endpoint URL | https://<your hostname>/mcp |
| Transport | Streamable HTTP |
| Authentication | Bearer token, through Supergateway (the server has no static key of its own) |
Give it a read-only identity
Create a ServiceAccount bound to the built-in view ClusterRole. view reads most resources, pod logs and events, but
not Secrets.
kubectl create namespace mcp
kubectl create serviceaccount mcp-viewer -n mcp
kubectl create clusterrolebinding mcp-viewer --clusterrole=view --serviceaccount=mcp:mcp-viewerConfigure the server read-only
The server reads its settings from a TOML file:
port = "8080" # Streamable HTTP at /mcp
read_only = true # only tools marked read-only
stateless = true # suits containers and several replicas
toolsets = ["core"] # pods, generic resources, eventsDeploy it with the Helm chart
(oci://ghcr.io/containers/charts/kubernetes-mcp-server; see its values for the configuration and ServiceAccount),
or as a Deployment that runs kubernetes-mcp-server --config /etc/kubernetes-mcp-server/config.toml as mcp-viewer.
In a pod, it uses that ServiceAccount's in-cluster credentials.
Put a key and https in front
The server has no static API key, so run Supergateway next to it with
--apiKey, and expose that over https:
supergateway --streamableHttp "http://kubernetes-mcp-server.mcp.svc:8080/mcp" \
--outputTransport streamableHttp --stateful --port 8000 --apiKey "$MCP_API_KEY"See Expose a self-hosted server for the Ingress. On a
self-hosted sremcp in the same cluster, you can skip this step and use
http://kubernetes-mcp-server.mcp.svc:8080/mcp directly.
Onboard in sremcp
| Field | Value |
|---|---|
| Display name / Slug | Kubernetes (prod) / k8s-prod |
| Endpoint URL | https://mcp-k8s.example.com/mcp |
| Transport | Streamable HTTP |
| Authentication | Bearer token, Secret = MCP_API_KEY |
Approve tools
With read_only = true, only read tools appear. A good start:
pods_list,pods_list_in_namespace,pods_get,pods_log,pods_topevents_list,namespaces_list,resources_list,resources_getnodes_top,nodes_stats_summary
Try it
- Which pods in payments restarted in the last hour, and what do their last logs say?
- Show warning events in the checkout namespace since 13:00 UTC.
- Which nodes are under memory pressure right now?
Troubleshooting
403when the server sits behind a proxy on127.0.0.1: its DNS-rebinding check rejects the proxy'sHostheader. Setdisable_localhost_protection = true, andbind_address = "127.0.0.1"so only the proxy reaches it.Forbiddenin tool results: the ServiceAccount's role doesn't allow that read.viewdeliberately excludes Secrets.