Kubernetes · Arazzo Workflow

Kubernetes Retire an Application from a Namespace

Version 1.0.0

Find an application's deployment, remove its service and deployment, and confirm the pods are gone.

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

Provider

kubernetes

Workflows

retire-application
Delete an application's service and deployment from a shared namespace.
Lists the namespace's deployments to locate the target, reads it for a record of what is being retired, deletes the service and then the deployment, and lists the remaining pods to confirm the cascade.
5 steps inputs: deploymentName, labelSelector, namespace, serviceName outputs: deletedDeploymentName, deletedServiceName, remainingPods, retiredImage, retiredReplicas
1
findDeployment
List the namespace's deployments narrowed to the application's label so the retirement targets only the intended workload.
2
readDeployment
Read the deployment for a record of the image and replica count being retired, which is what a rollback would need to recreate it.
3
deleteService
Delete the fronting service first so traffic stops being routed before the backends go away. A LoadBalancer service also deprovisions its cloud load balancer here.
4
deleteDeployment
Delete the deployment. Its ReplicaSet and pods are garbage-collected via their ownerReferences and terminate gracefully.
5
confirmPodsGone
List the pods still carrying the application's label to confirm the cascade removed them. Pods may briefly remain while terminating.

Source API Descriptions

Arazzo Workflow Specification

Raw ↑
arazzo: 1.0.1
info:
  title: Kubernetes Retire an Application from a Namespace
  summary: Find an application's deployment, remove its service and deployment, and confirm the pods are gone.
  description: >-
    Removing one application from a shared namespace, where deleting the whole
    namespace is not an option because other workloads live there. The workflow
    locates the deployment, deletes the fronting service first so traffic stops
    arriving before the backends disappear, deletes the deployment so its
    ReplicaSet and pods are garbage-collected, and lists the pods to confirm
    termination. 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: namespacesApi
  url: ../openapi/kubernetes-namespaces-api-openapi.yml
  type: openapi
- name: workloadsApi
  url: ../openapi/kubernetes-workloads-api-openapi.yml
  type: openapi
workflows:
- workflowId: retire-application
  summary: Delete an application's service and deployment from a shared namespace.
  description: >-
    Lists the namespace's deployments to locate the target, reads it for a
    record of what is being retired, deletes the service and then the
    deployment, and lists the remaining pods to confirm the cascade.
  inputs:
    type: object
    required:
    - namespace
    - deploymentName
    - serviceName
    properties:
      namespace:
        type: string
        description: The shared namespace the application lives in.
      deploymentName:
        type: string
        description: The deployment to retire.
      serviceName:
        type: string
        description: The service fronting the deployment, deleted before the backends.
      labelSelector:
        type: string
        description: Label selector matching the application's resources (e.g. app=nginx).
  steps:
  - stepId: findDeployment
    description: >-
      List the namespace's deployments narrowed to the application's label so
      the retirement targets only the intended workload.
    operationId: listNamespacedDeployments
    parameters:
    - name: namespace
      in: path
      value: $inputs.namespace
    - name: labelSelector
      in: query
      value: $inputs.labelSelector
    - name: limit
      in: query
      value: 100
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      deployments: $response.body#/items
    onSuccess:
    - name: deploymentFound
      type: goto
      stepId: readDeployment
      criteria:
      - context: $response.body
        condition: $.items.length > 0
        type: jsonpath
    - name: nothingToRetire
      type: end
      criteria:
      - context: $response.body
        condition: $.items.length == 0
        type: jsonpath
  - stepId: readDeployment
    description: >-
      Read the deployment for a record of the image and replica count being
      retired, which is what a rollback would need to recreate it.
    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
      retiredReplicas: $response.body#/spec/replicas
      retiredImage: $response.body#/spec/template/spec/containers/0/image
  - stepId: deleteService
    description: >-
      Delete the fronting service first so traffic stops being routed before
      the backends go away. A LoadBalancer service also deprovisions its
      cloud load balancer here.
    operationId: deleteNamespacedService
    parameters:
    - name: namespace
      in: path
      value: $inputs.namespace
    - name: name
      in: path
      value: $inputs.serviceName
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      deletedServiceName: $response.body#/metadata/name
  - stepId: deleteDeployment
    description: >-
      Delete the deployment. Its ReplicaSet and pods are garbage-collected via
      their ownerReferences and terminate gracefully.
    operationId: deleteNamespacedDeployment
    parameters:
    - name: namespace
      in: path
      value: $inputs.namespace
    - name: name
      in: path
      value: $steps.readDeployment.outputs.deploymentName
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      deletedDeploymentName: $response.body#/metadata/name
      deletionTimestamp: $response.body#/metadata/deletionTimestamp
  - stepId: confirmPodsGone
    description: >-
      List the pods still carrying the application's label to confirm the
      cascade removed them. Pods may briefly remain while terminating.
    operationId: listNamespacedPods
    parameters:
    - name: namespace
      in: path
      value: $inputs.namespace
    - name: labelSelector
      in: query
      value: $inputs.labelSelector
    - name: limit
      in: query
      value: 100
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      remainingPods: $response.body#/items
  outputs:
    retiredImage: $steps.readDeployment.outputs.retiredImage
    retiredReplicas: $steps.readDeployment.outputs.retiredReplicas
    deletedServiceName: $steps.deleteService.outputs.deletedServiceName
    deletedDeploymentName: $steps.deleteDeployment.outputs.deletedDeploymentName
    remainingPods: $steps.confirmPodsGone.outputs.remainingPods

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-retire-application-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.