Skip to main content
Glama

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
NameRequiredDescriptionDefault
deploymentYesThe name of the deployment to scale
namespaceNoThe namespace of the deployment (optional, defaults to current context namespace)
replicasYesThe number of replicas to scale to

Implementation Reference

  • 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` }] }; }
  • 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 }; });

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/thekaranpargaie/kube-mcp'

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