Skip to main content
Glama

pod_update

Update Kubernetes pod labels efficiently within specified context and namespace using k8s-pilot. Streamline metadata management across multiple clusters.

Instructions

Update an existing pod's metadata (only labels can be updated for an existing pod).

Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The pod name labels: New labels to apply to the pod

Returns: Information about the updated pod

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
context_nameYes
labelsNo
nameYes
namespaceYes

Implementation Reference

  • The pod_update tool handler decorated with @mcp.tool() for registration and permission checks. It reads the existing pod, updates its labels if provided, patches it via Kubernetes API, and returns status info.
    @mcp.tool() @use_current_context @check_readonly_permission def pod_update(context_name: str, namespace: str, name: str, labels: Optional[Dict[str, str]] = None): """ Update an existing pod's metadata (only labels can be updated for an existing pod). Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The pod name labels: New labels to apply to the pod Returns: Information about the updated pod """ core_v1: CoreV1Api = get_api_clients(context_name)["core"] # Get the current pod pod = core_v1.read_namespaced_pod(name=name, namespace=namespace) # Update pod labels if provided if labels: pod.metadata.labels = labels # Update the pod in Kubernetes updated_pod = core_v1.patch_namespaced_pod( name=name, namespace=namespace, body={"metadata": {"labels": labels}} ) result = { "name": updated_pod.metadata.name, "namespace": updated_pod.metadata.namespace, "status": updated_pod.status.phase, "labels": updated_pod.metadata.labels, } return result
  • tools/pod.py:243-243 (registration)
    The @mcp.tool() decorator registers the pod_update function as an MCP tool.
    @mcp.tool()

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