Skip to main content
Glama

deployment_update

Update Kubernetes deployments by specifying context, namespace, name, image, and replicas to modify container configurations and scale resources efficiently.

Instructions

Update an existing Deployment in the specified namespace.

Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The Deployment name image: The new container image to update replicas: The new number of replicas

Returns: Status of the update operation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
context_nameYes
imageYes
nameYes
namespaceYes
replicasYes

Implementation Reference

  • The handler function for the 'deployment_update' tool. It reads the existing deployment, updates the container image and replicas count, then replaces the deployment using the Kubernetes AppsV1Api. Decorated with @mcp.tool() for registration, @use_current_context to set the context, and @check_readonly_permission for access control.
    @mcp.tool() @use_current_context @check_readonly_permission def deployment_update(context_name: str, namespace: str, name: str, image: str, replicas: int): """ Update an existing Deployment in the specified namespace. Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The Deployment name image: The new container image to update replicas: The new number of replicas Returns: Status of the update operation """ apps_v1: AppsV1Api = get_api_clients(context_name)["apps"] deployment = apps_v1.read_namespaced_deployment(name=name, namespace=namespace) deployment.spec.template.spec.containers[0].image = image deployment.spec.replicas = replicas updated_deployment = apps_v1.replace_namespaced_deployment(name=name, namespace=namespace, body=deployment) return {"name": updated_deployment.metadata.name, "status": "Updated"}

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