k8s_cordon_node
Mark a Kubernetes node as unschedulable to prevent new pods from being scheduled, enabling safe maintenance or troubleshooting.
Instructions
Mark a node as unschedulable (cordon) — prevents new pods from being scheduled
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Node name |
Implementation Reference
- src/tools/kubernetes/nodes.ts:86-103 (handler)The handler function `cordonNode` that performs the actual K8s API call to cordon a node.
export async function cordonNode(args: Record<string, unknown>): Promise<string> { const api = getCoreV1Api(); const name = args.name as string; if (!name) throw new Error("Node name is required"); await api.patchNode( name, { spec: { unschedulable: true } }, undefined, undefined, undefined, undefined, undefined, { headers: { "Content-Type": "application/strategic-merge-patch+json" } } ); return `Node '${name}' cordoned — no new pods will be scheduled on this node.`; } - src/tools/kubernetes/index.ts:166-175 (registration)Registration of the `k8s_cordon_node` tool definition in the Kubernetes toolset.
name: "k8s_cordon_node", description: "Mark a node as unschedulable (cordon) — prevents new pods from being scheduled", inputSchema: { type: "object" as const, properties: { name: { type: "string", description: "Node name" }, }, required: ["name"], }, },