Troubleshooting - cturner8/kube-mcp GitHub Wiki

This page covers common issues and their solutions when running kube-mcp.

Deployment Issues

Pod fails to start

Check the pod logs for errors:

kubectl logs -l app.kubernetes.io/name=kube-mcp

Common causes:

Error Cause Solution
OIDC issuer URL is required Missing OIDC configuration Set mcp.oidc.issuerUrl in your values.yaml
OIDC client ID is required Missing client ID Set mcp.oidc.clientId in your values.yaml
Base URL is required Missing base URL Set mcp.baseUrl in your values.yaml
cannot specify both allowed and disallowed tools Conflicting tool config Use either mcp.tools.allowed OR mcp.tools.disallowed, not both

Pod is running but not ready

Check readiness probe failures:

kubectl describe pod -l app.kubernetes.io/name=kube-mcp

The server exposes a /health endpoint. If probes are failing, verify the container port matches your service configuration.

Authentication Issues

401 Unauthorized responses

Verify OIDC discovery is accessible:

curl https://<your-oidc-issuer>/.well-known/openid-configuration

Check the Protected Resource Metadata endpoint:

curl https://<your-mcp-url>/.well-known/oauth-protected-resource

Common causes:

Symptom Cause Solution
"token signature is invalid" Wrong signing method Verify mcp.oidc.signingMethod matches your provider (RS256 or HS256)
"token is expired" Expired JWT Obtain a fresh token from your OIDC provider
"audience claim mismatch" Wrong client ID Ensure mcp.oidc.clientId matches the aud claim in your token
"issuer claim mismatch" Wrong issuer URL Ensure mcp.oidc.issuerUrl exactly matches the iss claim

MCP client won't authenticate

If your MCP client isn't prompting for authentication:

  1. Verify the client supports OAuth/OIDC authentication
  2. Check the client supports HTTP transport
  3. Ensure the server URL is correct and accessible from your machine

Permission Errors

"forbidden" errors when using tools

Example: pods is forbidden: User "system:serviceaccount:..." cannot list resource "pods"

This indicates Kubernetes RBAC is blocking access. Verify the ServiceAccount permissions:

# Check what the ServiceAccount can access
kubectl auth can-i list pods --as=system:serviceaccount:<namespace>:kube-mcp

# View the ClusterRole rules
kubectl get clusterrole kube-mcp -o yaml

Solutions:

  • Add the missing resource to rbac.rules in your values.yaml
  • Ensure the resource's API group is included (e.g., apps for Deployments)

See RBAC for detailed configuration.

"secrets is forbidden"

Secrets and ConfigMaps are intentionally excluded from default RBAC. To enable:

  1. Add secrets/configmaps to rbac.rules
  2. Remove them from mcp.tools.disallowed (they're disabled by default)

Tool Issues

Tool not appearing in MCP client

Possible causes:

  1. Tool is disallowed - Check mcp.tools.disallowed doesn't include the tool
  2. Allowlist in use - If using mcp.tools.allowed, the tool must be explicitly listed
  3. Client caching - Restart your MCP client to refresh the tool list

Tool returns empty results

Possible causes:

  1. No resources exist - Verify resources exist in the specified namespace
  2. RBAC restrictions - The ServiceAccount may lack permission (check logs)
  3. Namespace not specified - Some tools require a namespace argument

Network Issues

Cannot reach kube-mcp from MCP client

Check ingress is configured:

kubectl get ingress -l app.kubernetes.io/name=kube-mcp

For testing without ingress, use port-forwarding:

kubectl port-forward svc/kube-mcp 9000:9000

Then configure your MCP client to use http://localhost:9000.

CORS errors in browser-based clients

If accessing kube-mcp from a browser and seeing CORS errors:

mcp:
  allowedOrigins: "https://your-app.example.com"

Multiple origins can be specified as comma-separated values.

Debugging

Enable debug logging

Increase log verbosity to diagnose issues:

mcp:
  logging:
    level: "debug"

Then view logs:

kubectl logs -l app.kubernetes.io/name=kube-mcp -f

Inspect JWT token claims

To debug authentication issues, decode your JWT token at jwt.io and verify:

  • iss matches mcp.oidc.issuerUrl
  • aud matches mcp.oidc.clientId
  • exp is in the future
  • Required scopes are present in scope or scp claim

Getting Help

⚠️ **GitHub.com Fallback** ⚠️