get_daemonsets
Retrieve all DaemonSets in a specified Kubernetes namespace using the MCP Kubernetes Server. Simplify cluster management by querying and organizing critical workload configurations.
Instructions
Get all daemonsets in the specified namespace
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| namespace | No | default |
Implementation Reference
- kubernetes.py:119-128 (handler)The main handler function for the 'get_daemonsets' tool. It uses kubectl to fetch DaemonSets in the specified namespace as JSON, with error handling. Registered via @mcp.tool() decorator.@mcp.tool() async def get_daemonsets(namespace: str = "default") -> dict: """Get all daemonsets in the specified namespace""" try: cmd = ["kubectl", "get", "daemonsets", "-n", namespace, "-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 daemonsets: {str(e)}"}