How to handle workloads that won't delete and are stuck in "waiting on foregroundDeletion."

July 4, 2018

I had a large number of workloads that I deleted with kubectl delete. They all fell into a state of “Waiting on foregroundDeletion.”

I believe that this happened because I had scaled them to 0 replicas a day ago while testing a different version of the application running inside. Workloads with no replicas would not delete. If I scaled it to 1 replica and immediately deleted the workload, the deletion passed through foregroundDeletion and completed.

I was able to finalize the deletion of the stuck workloads by patching the deployment and removing the finalizer key (Note that monitor-1a matched the stuck workloads):