Skip to main content
Glama

statefulset_update

Update StatefulSet configurations in Kubernetes, including container images and replica counts, across specified namespaces and contexts using the k8s-pilot MCP server.

Instructions

Update an existing StatefulSet in the specified namespace.

Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The StatefulSet 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 complete implementation of the `statefulset_update` tool handler. It reads the existing StatefulSet, updates the container image and replicas, then replaces it via the Kubernetes AppsV1 API. Registered with `@mcp.tool()`, uses current context, and checks permissions.
    @mcp.tool() @use_current_context @check_readonly_permission def statefulset_update(context_name: str, namespace: str, name: str, image: str, replicas: int): """ Update an existing StatefulSet in the specified namespace. Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The StatefulSet 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"] statefulset = apps_v1.read_namespaced_stateful_set(name=name, namespace=namespace) statefulset.spec.template.spec.containers[0].image = image statefulset.spec.replicas = replicas updated_statefulset = apps_v1.replace_namespaced_stateful_set(name=name, namespace=namespace, body=statefulset) return {"name": updated_statefulset.metadata.name, "status": "Updated"}
  • The `@mcp.tool()` decorator registers the `statefulset_update` function as an MCP tool.
    @mcp.tool()
  • Function signature with type hints and docstring defining the input parameters and return value for the tool.
    def statefulset_update(context_name: str, namespace: str, name: str, image: str, replicas: int): """ Update an existing StatefulSet in the specified namespace. Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The StatefulSet name image: The new container image to update replicas: The new number of replicas Returns: Status of the update operation """

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