DEV Community

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

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!

Discussion (2)

Collapse
nudzo profile image
Ivan Nudzik

But this delete successful ones, not failed.

Collapse
katydidknot profile image
katydidknot Author

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