Examples
Explore practical examples of using the Kubernetes Claude MCP server for various use cases. These examples demonstrate how to leverage the API for resource analysis, troubleshooting, and GitOps workflows.
Basic API Usage
Examples of common API calls for resource analysis
Analyzing a Pod
Query the status and health of a pod
curl -X POST \
-H "Content-Type: application/json" \
-H "X-API-Key: your_api_key" \
-d '{
"resource": "pod",
"name": "my-app-pod",
"namespace": "default",
"query": "Is this pod healthy? What do the resource usage metrics show?"
}' \
http://mcp-server.example.com/api/v1/mcp/resource
Checking Service Connectivity
Investigate connectivity issues between services
curl -X POST \
-H "Content-Type: application/json" \
-H "X-API-Key: your_api_key" \
-d '{
"resource": "service",
"name": "backend-service",
"namespace": "default",
"query": "Why can't my frontend pods connect to this service?"
}' \
http://mcp-server.example.com/api/v1/mcp/resource
Deployment Analysis
Understand why a deployment isn't scaling properly
curl -X POST \
-H "Content-Type: application/json" \
-H "X-API-Key: your_api_key" \
-d '{
"resource": "deployment",
"name": "web-frontend",
"namespace": "default",
"query": "Why is this deployment not scaling to the requested replicas?"
}' \
http://mcp-server.example.com/api/v1/mcp/resource
Troubleshooting
Examples for diagnosing and fixing common issues
CrashLoopBackOff Investigation
Troubleshoot a pod in CrashLoopBackOff state
curl -X POST \
-H "Content-Type: application/json" \
-H "X-API-Key: your_api_key" \
-d '{
"resource": "pod",
"name": "crashing-pod",
"namespace": "production",
"query": "This pod is in CrashLoopBackOff. What's causing it and how can I fix it?"
}' \
http://mcp-server.example.com/api/v1/mcp/troubleshoot
Ingress Issues
Debug problems with an Ingress resource
curl -X POST \
-H "Content-Type: application/json" \
-H "X-API-Key: your_api_key" \
-d '{
"resource": "ingress",
"name": "app-ingress",
"namespace": "default",
"query": "External users are getting 404 errors when accessing the application. What's wrong with this ingress?"
}' \
http://mcp-server.example.com/api/v1/mcp/troubleshoot
Storage Problems
Troubleshoot issues with PersistentVolumeClaims
curl -X POST \
-H "Content-Type: application/json" \
-H "X-API-Key: your_api_key" \
-d '{
"resource": "persistentvolumeclaim",
"name": "database-storage",
"namespace": "database",
"query": "Why is this PVC stuck in pending state?"
}' \
http://mcp-server.example.com/api/v1/mcp/troubleshoot
GitOps Workflows
Examples for CI/CD integration and GitOps analysis
ArgoCD Application Analysis
Check sync status and health of an ArgoCD application
curl -X POST \
-H "Content-Type: application/json" \
-H "X-API-Key: your_api_key" \
-d '{
"resource": "application",
"name": "production-app",
"namespace": "argocd",
"query": "Is this application synced and healthy? If not, what are the issues?"
}' \
http://mcp-server.example.com/api/v1/mcp/resource
Commit Impact Analysis
Analyze how a specific commit affected the cluster
curl -X POST \
-H "Content-Type: application/json" \
-H "X-API-Key: your_api_key" \
-d '{
"projectId": "mygroup/myproject",
"commitSha": "a1b2c3d4e5f6",
"query": "What changes were made in this commit and how have they affected the deployed resources?"
}' \
http://mcp-server.example.com/api/v1/mcp/commit
ArgoCD Sync Failure
Troubleshoot why an ArgoCD application isn't syncing
curl -X POST \
-H "Content-Type: application/json" \
-H "X-API-Key: your_api_key" \
-d '{
"resource": "application",
"name": "failing-app",
"namespace": "argocd",
"query": "Why is this application failing to sync? What specific errors are occurring?"
}' \
http://mcp-server.example.com/api/v1/mcp/troubleshoot
Advanced Usage
Examples for more complex scenarios and integrations
Resource Relationship Analysis
Understanding dependencies between resources
curl -X POST \
-H "Content-Type: application/json" \
-H "X-API-Key: your_api_key" \
-d '{
"resource": "deployment",
"name": "application",
"namespace": "production",
"query": "Create a map of all resources related to this deployment, including services, configmaps, secrets, and ingresses."
}' \
http://mcp-server.example.com/api/v1/mcp/resource
Multi-Resource Correlation
Analyze interactions between multiple resources
curl -X POST \
-H "Content-Type: application/json" \
-H "X-API-Key: your_api_key" \
-d '{
"query": "Analyze the connection between the frontend deployment, backend service, and redis statefulset in the web namespace. Are there any connectivity or configuration issues?"
}' \
http://mcp-server.example.com/api/v1/mcp
GitOps Security Audit
Audit resources for security issues and best practices
curl -X POST \
-H "Content-Type: application/json" \
-H "X-API-Key: your_api_key" \
-d '{
"resource": "namespace",
"name": "production",
"query": "Perform a security audit of all resources in this namespace. Check for security best practices, RBAC issues, and potential vulnerabilities."
}' \
http://mcp-server.example.com/api/v1/mcp/resource
Need More Help?
Check out the detailed usage guides in the documentation or visit our GitHub repository.