capabilities.work

Retire an Application from a Namespace

A 5-step recipe with Kubernetes. We can help you get access.

Recipe · 5 steps

Retire an Application from a Namespace

Delete an application's service and deployment from a shared namespace.

  1. List the namespace's deployments narrowed to the application's label so the retirement targets only the intended workload.
  2. 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. 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. Delete the deployment. Its ReplicaSet and pods are garbage-collected via their ownerReferences and terminate gracefully.
  5. List the pods still carrying the application's label to confirm the cascade removed them. Pods may briefly remain while terminating.
What you'll need to have ready
  • namespace: The shared namespace the application lives in.
  • deploymentName: The deployment to retire.
  • serviceName: The service fronting the deployment, deleted before the backends.
  • labelSelector: Label selector matching the application's resources (e.g. app=nginx).
For your developer

Arazzo workflow kubernetes:retire-application, 5 operations: listNamespacedDeployments → getNamespacedDeployment → deleteNamespacedService → deleteNamespacedDeployment → listNamespacedPods. Specs on APIs.io.