daemonset_create
Create a DaemonSet in Kubernetes to run a container image on every node within a specified namespace, applying labels for organization.
Instructions
Create a DaemonSet in the specified namespace.
Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The DaemonSet name image: The container image to use labels: Labels to apply to the DaemonSet
Returns: Status of the creation operation
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| context_name | Yes | ||
| namespace | Yes | ||
| name | Yes | ||
| image | Yes | ||
| labels | Yes |
Implementation Reference
- tools/daemonset.py:27-56 (handler)The main handler function for the 'daemonset_create' tool. It is decorated with @mcp.tool() which registers it as an MCP tool, @use_current_context for context management, and @check_readonly_permission for access control. The function creates a Kubernetes DaemonSet in the specified namespace using the provided parameters.@mcp.tool() @use_current_context @check_readonly_permission def daemonset_create(context_name: str, namespace: str, name: str, image: str, labels: dict): """ Create a DaemonSet in the specified namespace. Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The DaemonSet name image: The container image to use labels: Labels to apply to the DaemonSet Returns: Status of the creation operation """ apps_v1: AppsV1Api = get_api_clients(context_name)["apps"] daemonset = V1DaemonSet( metadata=V1ObjectMeta(name=name, labels=labels), spec={ "selector": {"matchLabels": labels}, "template": V1PodTemplateSpec( metadata=V1ObjectMeta(labels=labels), spec=V1PodSpec(containers=[V1Container(name=name, image=image)]) ) } ) created_daemonset = apps_v1.create_namespaced_daemon_set(namespace=namespace, body=daemonset) return {"name": created_daemonset.metadata.name, "status": "Created"}
- tools/daemonset.py:27-27 (registration)The @mcp.tool() decorator registers the daemonset_create function as an MCP tool.@mcp.tool()
- tools/daemonset.py:30-43 (schema)Function signature with type hints and docstring defining the input schema and output for the tool.def daemonset_create(context_name: str, namespace: str, name: str, image: str, labels: dict): """ Create a DaemonSet in the specified namespace. Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The DaemonSet name image: The container image to use labels: Labels to apply to the DaemonSet Returns: Status of the creation operation """