Skip to main content
Glama

statefulset_create

Create a StatefulSet in Kubernetes to deploy and manage stateful applications with persistent storage and stable network identities.

Instructions

Create a StatefulSet in the specified namespace.

Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The StatefulSet name image: The container image to use replicas: Number of replicas labels: Labels to apply to the StatefulSet

Returns: Status of the creation operation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
context_nameYes
namespaceYes
nameYes
imageYes
replicasYes
labelsYes

Implementation Reference

  • The statefulset_create tool handler function, registered via @mcp.tool() decorator. It creates a Kubernetes StatefulSet in the specified namespace using the provided parameters, leveraging Kubernetes Python client APIs.
    @mcp.tool() @use_current_context @check_readonly_permission def statefulset_create(context_name: str, namespace: str, name: str, image: str, replicas: int, labels: dict): """ Create a StatefulSet in the specified namespace. Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The StatefulSet name image: The container image to use replicas: Number of replicas labels: Labels to apply to the StatefulSet Returns: Status of the creation operation """ apps_v1: AppsV1Api = get_api_clients(context_name)["apps"] statefulset = V1StatefulSet( metadata=V1ObjectMeta(name=name, labels=labels), spec=V1StatefulSetSpec( replicas=replicas, selector=V1LabelSelector(match_labels=labels), service_name=name, template=V1PodTemplateSpec( metadata=V1ObjectMeta(labels=labels), spec=V1PodSpec(containers=[V1Container(name=name, image=image)]) ) ) ) created_statefulset = apps_v1.create_namespaced_stateful_set(namespace=namespace, body=statefulset) return {"name": created_statefulset.metadata.name, "status": "Created"}

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