replicaset_update
Update an existing ReplicaSet's container image and replica count in a specified Kubernetes namespace to modify application deployment configurations.
Instructions
Update an existing ReplicaSet in the specified namespace.
Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The ReplicaSet name image: The new container image to update replicas: The new number of replicas
Returns: Status of the update operation
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| context_name | Yes | ||
| namespace | Yes | ||
| name | Yes | ||
| image | Yes | ||
| replicas | Yes |
Implementation Reference
- tools/replicaset.py:88-107 (handler)The handler function for the 'replicaset_update' tool. It updates an existing ReplicaSet by changing the container image and the number of replicas using the Kubernetes AppsV1Api.def replicaset_update(context_name: str, namespace: str, name: str, image: str, replicas: int): """ Update an existing ReplicaSet in the specified namespace. Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The ReplicaSet 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"] replicaset = apps_v1.read_namespaced_replica_set(name=name, namespace=namespace) replicaset.spec.template.spec.containers[0].image = image replicaset.spec.replicas = replicas updated_replicaset = apps_v1.replace_namespaced_replica_set(name=name, namespace=namespace, body=replicaset) return {"name": updated_replicaset.metadata.name, "status": "Updated"}
- tools/replicaset.py:85-85 (registration)Registers the 'replicaset_update' tool using the @mcp.tool() decorator from the MCP server.@mcp.tool()