View a markdown version of this page

Application cleanup: Removing redundant workloads - AWS Prescriptive Guidance

Application cleanup: Removing redundant workloads

Once idle clusters are addressed, clean up abandoned workloads within active clusters. Leftover deployments, failed jobs, and orphaned resources prevent efficient bin-packing and inflate node count.

Identify redundant and abandoned applications

Find deployments, jobs, and services that are no longer needed, leftover from testing, failed rollouts, or decommissioned features. Key signals include:

  • Deployments scaled to zero or with zero available replicas

  • Pods in CrashLoopBackOff with high restart counts (>10)

  • Completed/failed Jobs not cleaned up

  • Orphaned Services with empty endpoints (no backing pods)

  • Unbound PVCs (storage provisioned but not mounted)

  • Stale namespaces with zero pods and no recent events

For scripts, see this GitHub repository to identify redundant and abandoned applications.

Identify stale namespaces

Entire namespaces can become abandoned after projects end or teams reorganize, they accumulate resources silently. For sample commands, see this GitHub repository to identify stale namespaces.

Actions

Once you've identified redundant resources, take action to reclaim costs. The cleanup script covers:

  • Deleting completed/failed Jobs older than 7 days

  • Removing pods stuck in Failed state

  • Scaling down deployments in unused namespaces

  • Deleting orphaned PVCs (after confirmation)

For cleanup commands, see this GitHub repository ⚠️ Always run cleanup scripts in --dry-run mode first and confirm with the owning team before deleting any resource in production.

Abandoned workloads fragment your cluster capacity and prevent autoscalers from consolidating nodes. Cleaning them up often frees enough resources to scale down one or more nodes immediately, typically saving $70–$200/month per reclaimed node.

Recommendations

  • Implement a "traffic audit" dashboard showing per-application request rates

  • Set alerts for deployments with zero ingress traffic for more than 72 hours

  • Use Kubernetes scale-to-zero solutions (e.g., KEDA (Kubernetes Event-driven Autoscaling) with minReplicaCount: 0) for intermittent workloads

  • Establish an application lifecycle policy requiring periodic revalidation of deployed services

  • Set ttlSecondsAfterFinished: 86400 on all Job specs to auto-clean completed jobs after 24 hours

For the complete scripts and manifests, see the 02-application-cleanup folder in the code repository.