Skip to main content
Glama
abhijeetka
by abhijeetka

create_deployment

Deploy containerized applications to Kubernetes by specifying name, image, namespace, and replica count for scalable cluster management.

Instructions

Create a Kubernetes deployment with specified name, image, namespace and replicas

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
imageYes
namespaceNodefault
replicasNo

Implementation Reference

  • This is the handler function for the 'create_deployment' tool, decorated with @mcp.tool() which registers it in the FastMCP server. It uses kubectl to create a deployment with the given name, image, namespace, and replicas.
    @mcp.tool()
    async def create_deployment(name: str, image: str, namespace: str = "default", replicas: int = 1) -> dict:
        """Create a Kubernetes deployment with specified name, image, namespace and replicas"""
        try:
            # Apply the deployment
            cmd = ["kubectl", "create", "deploy", name, 
                   "--replicas", str(replicas), 
                   "--image", image,
                   "-n", namespace]
            result = subprocess.run(cmd, capture_output=True, text=True, check=True)
            
            return {"message": f"Deployment {name} created successfully in namespace {namespace}", 
                    "details": result.stdout}
        except subprocess.CalledProcessError as e:
            return {"error": f"Failed to create deployment: {str(e)}"}

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/abhijeetka/mcp-k8s-server'

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