get_failing_pods
Identify and retrieve all problematic pods within a specified Kubernetes namespace to simplify troubleshooting and cluster management.
Instructions
Get all pods with issues in the specified namespace
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| namespace | No | default |
Implementation Reference
- kubernetes.py:25-33 (handler)Handler function for the 'get_failing_pods' tool. Uses kubectl to fetch pods not in Running phase in the given namespace, parses JSON output, with error handling. Registered via @mcp.tool() decorator.@mcp.tool() async def get_failing_pods(namespace: str = "default") -> dict: """Get all pods with issues in the specified namespace""" try: cmd = ["kubectl", "get", "pods", "-n", namespace, "--field-selector=status.phase!=Running", "-o", "json"] result = subprocess.run(cmd, capture_output=True, text=True, check=True) return json.loads(result.stdout) except subprocess.CalledProcessError as e: return {"error": f"Failed to get pods: {str(e)}"}