replicaset_update
Update a Kubernetes ReplicaSet by specifying the namespace, name, container image, and replica count using the MCP server k8s-pilot. Manage cluster resources efficiently.
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 | ||
| image | Yes | ||
| name | Yes | ||
| namespace | Yes | ||
| replicas | Yes |
Implementation Reference
- tools/replicaset.py:85-107 (handler)The main handler function for the 'replicaset_update' tool, decorated with @mcp.tool() for registration, @use_current_context for context management, and @check_readonly_permission for permissions. It updates the image and replicas of a ReplicaSet using Kubernetes AppsV1Api.@mcp.tool() @use_current_context @check_readonly_permission 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)The @mcp.tool() decorator registers the replicaset_update function as an MCP tool.@mcp.tool()