scale-deployment
Scale a Kubernetes deployment to a specified number of replicas by providing the deployment name and desired replica count.
Instructions
Scale a Kubernetes deployment to a specified number of replicas
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| deployment | Yes | The name of the deployment to scale | |
| namespace | No | The namespace of the deployment (optional, defaults to current context namespace) | |
| replicas | Yes | The number of replicas to scale to |
Implementation Reference
- server.js:1656-1667 (handler)The handler function for the 'scale-deployment' tool. It extracts arguments, constructs a 'kubectl scale deployment' command with the specified replicas and optional namespace, executes it via execAsync, and returns the stdout or a success message.case "scale-deployment": { const { deployment, namespace, replicas } = args; const nsArg = namespace ? `-n ${namespace}` : ""; const cmd = `kubectl scale deployment ${deployment} --replicas=${replicas} ${nsArg}`; const { stdout } = await execAsync(cmd); return { content: [{ type: "text", text: stdout || `Deployment ${deployment} scaled to ${replicas} replicas` }] }; }
- server.js:404-424 (schema)The input schema definition for the 'scale-deployment' tool, defining properties for deployment name (required string), optional namespace (string), and replicas (required number). This schema is used for input validation and is returned in the tool list for clients.name: "scale-deployment", description: "Scale a Kubernetes deployment to a specified number of replicas", inputSchema: { type: "object", properties: { deployment: { type: "string", description: "The name of the deployment to scale" }, namespace: { type: "string", description: "The namespace of the deployment (optional, defaults to current context namespace)" }, replicas: { type: "number", description: "The number of replicas to scale to" } }, required: ["deployment", "replicas"] } },
- server.js:1392-1394 (registration)The request handler for ListToolsRequestSchema that returns the array of all tool definitions, including 'scale-deployment', effectively registering all tools including this one.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; });