Skip to main content
Glama

k8s_scale_deployment

Scale Kubernetes deployments to adjust replica counts for managing application capacity and resource allocation in your cluster.

Instructions

Scale a deployment to a specified number of replicas

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesDeployment name
namespaceNoKubernetes namespace (default: 'default')
replicasYesDesired number of replicas

Implementation Reference

  • The actual implementation of the tool, performing the scale operation via Kubernetes API patch.
    export async function scaleDeployment(args: Record<string, unknown>): Promise<string> {
      const api = getAppsV1Api();
      const namespace = (args.namespace as string) || "default";
      const name = args.name as string;
      const replicas = args.replicas as number;
    
      if (!name) throw new Error("Deployment name is required");
      if (replicas === undefined) throw new Error("Replicas count is required");
    
      const patch = { spec: { replicas } };
      await api.patchNamespacedDeployment(
        name,
        namespace,
        patch,
        undefined,
        undefined,
        undefined,
        undefined,
        undefined,
        { headers: { "Content-Type": "application/strategic-merge-patch+json" } }
      );
    
      return `Deployment '${name}' scaled to ${replicas} replicas in namespace '${namespace}'.`;
    }
  • Tool registration definition for "k8s_scale_deployment" including its input schema.
      name: "k8s_scale_deployment",
      description: "Scale a deployment to a specified number of replicas",
      inputSchema: {
        type: "object" as const,
        properties: {
          name: { type: "string", description: "Deployment name" },
          namespace: { type: "string", description: "Kubernetes namespace (default: 'default')" },
          replicas: { type: "number", description: "Desired number of replicas" },
        },
        required: ["name", "replicas"],
      },
    },

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/batu-sonmez/infraclaude'

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