Kubernetes · Arazzo Workflow

Kubernetes Attach a HorizontalPodAutoscaler to a Deployment

Version 1.0.0

Confirm a deployment exists, create an HPA targeting it, and list the namespace's autoscalers.

1 workflow 2 source APIs 1 provider
View Spec View on GitHub AutomationCloud-NativeCNCFContainersDeploymentOpen-SourceOrchestrationScalingArazzoWorkflows

Provider

kubernetes

Workflows

autoscale-deployment
Create a HorizontalPodAutoscaler bound to an existing deployment.
Reads the deployment to validate the scale target, creates an HPA referencing it by kind and name with min/max replica bounds, and lists the namespace's autoscalers to confirm the new HPA is registered.
3 steps inputs: deploymentName, hpaName, maxReplicas, minReplicas, namespace outputs: autoscalers, configuredMaxReplicas, configuredMinReplicas, hpaName
1
resolveScaleTarget
Read the deployment the HPA will target. An HPA pointing at a non-existent target is created successfully but never scales anything.
2
createAutoscaler
Create the HorizontalPodAutoscaler bound to the deployment by scaleTargetRef, with the supplied replica floor and ceiling.
3
verifyAutoscaler
List the namespace's autoscalers to confirm the HPA is registered and to report the replica counts the controller has computed so far.

Source API Descriptions

Arazzo Workflow Specification

Raw ↑
arazzo: 1.0.1
info:
  title: Kubernetes Attach a HorizontalPodAutoscaler to a Deployment
  summary: Confirm a deployment exists, create an HPA targeting it, and list the namespace's autoscalers.
  description: >-
    Handing replica control to the autoscaler is the step that turns a fixed
    deployment into an elastic one. The workflow resolves the target deployment
    first, because an HPA whose scaleTargetRef points at a missing resource is
    accepted by the API server and then silently fails to scale, creates the
    autoscaler with explicit min and max replica bounds, and lists the
    namespace's HPAs to confirm registration. Every step spells out its request
    inline so the flow can be read and executed without opening the underlying
    OpenAPI description.
  version: 1.0.0
sourceDescriptions:
- name: autoscalingApi
  url: ../openapi/kubernetes-autoscaling-api-openapi.yml
  type: openapi
- name: workloadsApi
  url: ../openapi/kubernetes-workloads-api-openapi.yml
  type: openapi
workflows:
- workflowId: autoscale-deployment
  summary: Create a HorizontalPodAutoscaler bound to an existing deployment.
  description: >-
    Reads the deployment to validate the scale target, creates an HPA
    referencing it by kind and name with min/max replica bounds, and lists the
    namespace's autoscalers to confirm the new HPA is registered.
  inputs:
    type: object
    required:
    - namespace
    - deploymentName
    - minReplicas
    - maxReplicas
    properties:
      namespace:
        type: string
        description: The namespace containing the deployment and the new HPA.
      deploymentName:
        type: string
        description: The deployment the autoscaler will scale.
      hpaName:
        type: string
        description: Name for the HorizontalPodAutoscaler resource.
      minReplicas:
        type: integer
        description: Minimum replica count the autoscaler may scale down to.
      maxReplicas:
        type: integer
        description: Maximum replica count the autoscaler may scale up to.
  steps:
  - stepId: resolveScaleTarget
    description: >-
      Read the deployment the HPA will target. An HPA pointing at a
      non-existent target is created successfully but never scales anything.
    operationId: getNamespacedDeployment
    parameters:
    - name: namespace
      in: path
      value: $inputs.namespace
    - name: name
      in: path
      value: $inputs.deploymentName
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      deploymentName: $response.body#/metadata/name
      currentReplicas: $response.body#/spec/replicas
  - stepId: createAutoscaler
    description: >-
      Create the HorizontalPodAutoscaler bound to the deployment by
      scaleTargetRef, with the supplied replica floor and ceiling.
    operationId: createNamespacedHorizontalPodAutoscaler
    parameters:
    - name: namespace
      in: path
      value: $inputs.namespace
    requestBody:
      contentType: application/json
      payload:
        apiVersion: autoscaling/v2
        kind: HorizontalPodAutoscaler
        metadata:
          name: $inputs.hpaName
          namespace: $inputs.namespace
        spec:
          scaleTargetRef:
            apiVersion: apps/v1
            kind: Deployment
            name: $steps.resolveScaleTarget.outputs.deploymentName
          minReplicas: $inputs.minReplicas
          maxReplicas: $inputs.maxReplicas
    successCriteria:
    - condition: $statusCode == 201
    outputs:
      hpaName: $response.body#/metadata/name
      hpaUid: $response.body#/metadata/uid
      configuredMinReplicas: $response.body#/spec/minReplicas
      configuredMaxReplicas: $response.body#/spec/maxReplicas
  - stepId: verifyAutoscaler
    description: >-
      List the namespace's autoscalers to confirm the HPA is registered and to
      report the replica counts the controller has computed so far.
    operationId: listNamespacedHorizontalPodAutoscalers
    parameters:
    - name: namespace
      in: path
      value: $inputs.namespace
    - name: limit
      in: query
      value: 100
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      autoscalers: $response.body#/items
      firstCurrentReplicas: $response.body#/items/0/status/currentReplicas
      firstDesiredReplicas: $response.body#/items/0/status/desiredReplicas
  outputs:
    hpaName: $steps.createAutoscaler.outputs.hpaName
    configuredMinReplicas: $steps.createAutoscaler.outputs.configuredMinReplicas
    configuredMaxReplicas: $steps.createAutoscaler.outputs.configuredMaxReplicas
    autoscalers: $steps.verifyAutoscaler.outputs.autoscalers

Work with this as data

Every workflow here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for arazzo workflows

4 MCP tools reach this
  • find_arazzoBrowse and filter every workflow in the catalog.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This workflow
curl "https://apis.io/api/v1/arazzo/kubernetes-autoscale-deployment-workflow"
All arazzo workflows
curl "https://apis.io/api/v1/arazzo?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.