Skip to main content
Glama

remove_node_taint

Remove specified taints from Kubernetes nodes using context, node name, and taint key to update node configurations efficiently.

Instructions

Remove a taint from a node.

Args: context_name: The Kubernetes context name node_name: The name of the node to modify taint_key: The taint key to remove

Returns: JSON string containing the updated node taints

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
context_nameYes
node_nameYes
taint_keyYes

Implementation Reference

  • The implementation of the 'remove_node_taint' tool. This handler function removes a taint from a Kubernetes node using the Kubernetes API client. It reads the current node, filters out the specified taint, and patches the node if the taint was found. The @mcp.tool() decorator registers it as an MCP tool.
    @mcp.tool() @use_current_context def remove_node_taint(context_name: str, node_name: str, taint_key: str): """ Remove a taint from a node. Args: context_name: The Kubernetes context name node_name: The name of the node to modify taint_key: The taint key to remove Returns: JSON string containing the updated node taints """ core_v1: CoreV1Api = get_api_clients(context_name)["core"] # Get the current node node = core_v1.read_node(node_name) # Check if the node has taints if not node.spec.taints: result = { "name": node_name, "taints": [], "message": "Node has no taints" } return json.dumps(result) # Filter out the taint to remove updated_taints = [taint for taint in node.spec.taints if taint.key != taint_key] # Check if taint was found if len(updated_taints) == len(node.spec.taints): result = { "name": node_name, "taints": [{"key": taint.key, "value": taint.value, "effect": taint.effect} for taint in node.spec.taints], "message": f"Taint with key '{taint_key}' not found" } return json.dumps(result) # Apply the patch body = { "spec": { "taints": [ { "key": taint.key, "value": taint.value, "effect": taint.effect } for taint in updated_taints ] } } patched_node = core_v1.patch_node(node_name, body) # Format the taints for response response_taints = [] if patched_node.spec.taints: response_taints = [ { "key": taint.key, "value": taint.value, "effect": taint.effect } for taint in patched_node.spec.taints ] result = { "name": patched_node.metadata.name, "taints": response_taints } return json.dumps(result)

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