Skip to main content
Glama

serviceaccount_create

Create a Kubernetes ServiceAccount in a specified namespace using context details and optional labels, managed via the k8s-pilot MCP server.

Instructions

Create a ServiceAccount in the specified namespace.

Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The ServiceAccount name labels: Optional labels to apply to the ServiceAccount

Returns: Status of the creation operation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
context_nameYes
labelsNo
nameYes
namespaceYes

Implementation Reference

  • The core handler function that executes the logic to create a new Kubernetes ServiceAccount in the given namespace, using type hints for input schema.
    def serviceaccount_create(context_name: str, namespace: str, name: str, labels: dict = None): """ Create a ServiceAccount in the specified namespace. Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The ServiceAccount name labels: Optional labels to apply to the ServiceAccount Returns: Status of the creation operation """ core_v1: CoreV1Api = get_api_clients(context_name)["core"] serviceaccount = V1ServiceAccount( metadata=V1ObjectMeta(name=name, labels=labels) ) created_serviceaccount = core_v1.create_namespaced_service_account(namespace=namespace, body=serviceaccount) return {"name": created_serviceaccount.metadata.name, "status": "Created"}
  • Registers the serviceaccount_create function as an MCP tool using the @mcp.tool() decorator.
    @mcp.tool()
  • Docstring providing input arguments description and return value for the tool schema.
    """ Create a ServiceAccount in the specified namespace. Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The ServiceAccount name labels: Optional labels to apply to the ServiceAccount Returns: Status of the creation 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