pod_delete
Remove a specific pod from a Kubernetes namespace using the given context. Leverage this tool within the k8s-pilot MCP server to manage deployments effectively.
Instructions
Delete a pod from the specified namespace.
Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The pod name to delete
Returns: Status of the deletion operation
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| context_name | Yes | ||
| name | Yes | ||
| namespace | Yes |
Implementation Reference
- tools/pod.py:285-332 (handler)The handler function for the 'pod_delete' MCP tool. It deletes the specified Kubernetes pod using the Kubernetes CoreV1Api client. Includes decorators for tool registration (@mcp.tool()), context usage (@use_current_context), and permission check (@check_readonly_permission). No separate schema; uses Python type hints and docstring for input/output.@mcp.tool() @use_current_context @check_readonly_permission def pod_delete(context_name: str, namespace: str, name: str): """ Delete a pod from the specified namespace. Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The pod name to delete Returns: Status of the deletion operation """ core_v1: CoreV1Api = get_api_clients(context_name)["core"] try: # Delete the pod api_response = core_v1.delete_namespaced_pod( name=name, namespace=namespace, body={} # Default deletion options ) # Check if the response indicates success if api_response.status == "Success": return { "name": name, "namespace": namespace, "status": "Deleted", "message": f"Pod {name} deleted successfully" } else: return { "name": name, "namespace": namespace, "status": "Failed", "message": f"Failed to delete pod {name}: {api_response.status}" } except Exception as e: return { "name": name, "namespace": namespace, "status": "Error", "message": f"An error occurred while deleting pod {name}: {str(e)}" }