Skip to main content
Glama

remove_annotation

Remove specific annotations from Kubernetes resources, such as pods, services, or deployments, by specifying the resource type, name, and annotation key. Simplifies Kubernetes management through targeted cleanup.

Instructions

Remove an annotation from a Kubernetes resource

Args: resource_type: Type of the resource (e.g., pod, service, deployment) resource_name: Name of the resource to remove the annotation from annotation_key: Key of the annotation to remove namespace: Namespace of the resource

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
annotation_keyYes
namespaceNodefault
resource_nameYes
resource_typeYes

Implementation Reference

  • The main handler function for the 'remove_annotation' MCP tool. Decorated with @mcp.tool() which registers it. Executes kubectl annotate command with the annotation key suffixed by '-' to remove the annotation from the specified Kubernetes resource.
    @mcp.tool() async def remove_annotation(resource_type: str, resource_name: str, annotation_key: str, namespace: str = "default") -> dict: """Remove an annotation from a Kubernetes resource Args: resource_type: Type of the resource (e.g., pod, service, deployment) resource_name: Name of the resource to remove the annotation from annotation_key: Key of the annotation to remove namespace: Namespace of the resource """ try: cmd = ["kubectl", "annotate", resource_type, resource_name, f"{annotation_key}-", "-n", namespace, "--overwrite"] result = subprocess.run(cmd, capture_output=True, text=True, check=True) return {"message": f"Annotation {annotation_key} removed from resource {resource_type}/{resource_name} in namespace {namespace}", "details": result.stdout} except subprocess.CalledProcessError as e: return {"error": f"Failed to remove annotation: {str(e)}"}

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/abhijeetka/mcp-k8s-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server