DEV Community

Cover image for How to quickly delete multiple jobs in kubernetes
katydidknot for Focused

Posted on • Updated on • Originally published at focusedlabs.io

How to quickly delete multiple jobs in kubernetes

Kube jobs running wild?

To delete successful jobs:

kubectl delete jobs --field-selector status.successful=1
Enter fullscreen mode Exit fullscreen mode

To delete failed or long running jobs

kubectl delete jobs --field-selector status.successful=0
Enter fullscreen mode Exit fullscreen mode

Get rid of them all!

Top comments (3)

Collapse
 
agfe2silver profile image
silver lee

work well for pending jobs!

Collapse
 
nudzo profile image
Ivan Nudzik

But this delete successful ones, not failed.

Collapse
 
katydidknot profile image
katydidknot

You are correct- bad copy pasta...OOPS.
Updating now