Skip to main content
Glama

deployment_create

Create a Kubernetes Deployment in a specified namespace with the desired container image, replica count, and labels, using the k8s-pilot MCP server for streamlined cluster management.

Instructions

Create a Deployment in the specified namespace.

Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The Deployment name image: The container image to use replicas: Number of replicas labels: Labels to apply to the Deployment

Returns: Status of the creation operation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
context_nameYes
imageYes
labelsYes
nameYes
namespaceYes
replicasYes

Implementation Reference

  • The handler function decorated with @mcp.tool() that implements the logic to create a Kubernetes Deployment using the AppsV1Api client.
    @mcp.tool() @use_current_context @check_readonly_permission def deployment_create(context_name: str, namespace: str, name: str, image: str, replicas: int, labels: dict): """ Create a Deployment in the specified namespace. Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The Deployment name image: The container image to use replicas: Number of replicas labels: Labels to apply to the Deployment Returns: Status of the creation operation """ apps_v1: AppsV1Api = get_api_clients(context_name)["apps"] deployment = V1Deployment( metadata=V1ObjectMeta(name=name, labels=labels), spec={ "replicas": replicas, "selector": V1LabelSelector(match_labels=labels), "template": V1PodTemplateSpec( metadata=V1ObjectMeta(labels=labels), spec=V1PodSpec(containers=[V1Container(name=name, image=image)]) ) } ) created_deployment = apps_v1.create_namespaced_deployment(namespace=namespace, body=deployment) return {"name": created_deployment.metadata.name, "status": "Created"}
  • server/server.py:12-12 (registration)
    Import of the tools.deployment module in the load_modules function, which triggers the execution of @mcp.tool() decorators to register the deployment_create tool.
    import tools.deployment # noqa: F401

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bourbonkk/k8s-pilot'

If you have feedback or need assistance with the MCP directory API, please join our Discord server