Skip to main content
Glama

update_deployment

Modify Kubernetes deployments by updating replica counts or container images. Specify the deployment name, namespace, and optional parameters for replicas or image changes.

Instructions

Update a Kubernetes deployment with new replicas count and/or image

Args: name: Name of the deployment to update namespace: Namespace of the deployment replicas: New number of replicas (optional) image: New container image (optional)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
imageNo
nameYes
namespaceNodefault
replicasNo

Implementation Reference

  • Handler function decorated with @mcp.tool() that implements the update_deployment tool. It uses kubectl to optionally scale the deployment replicas and/or update the container image, returning success or error details.
    @mcp.tool() async def update_deployment(name: str, namespace: str = "default", replicas: int = None, image: str = None) -> dict: """Update a Kubernetes deployment with new replicas count and/or image Args: name: Name of the deployment to update namespace: Namespace of the deployment replicas: New number of replicas (optional) image: New container image (optional) """ try: if replicas is None and image is None: return {"error": "Must specify either replicas or image to update"} updates = [] if replicas is not None: cmd = ["kubectl", "scale", "deployment", name, "--replicas", str(replicas), "-n", namespace] result = subprocess.run(cmd, capture_output=True, text=True, check=True ) updates.append(f"Scaled replicas to {replicas}") if image is not None: cmd = ["kubectl", "set", "image", f"deployment/{name}", f"{name}={image}", "-n", namespace] result = subprocess.run(cmd, capture_output=True, text=True, check=True ) updates.append(f"Updated image to {image}") return { "message": f"Deployment {name} updated successfully in namespace {namespace}", "updates": updates, "details": result.stdout } except subprocess.CalledProcessError as e: return {"error": f"Failed to update 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