Created
April 23, 2019 14:54
-
-
Save fermayo/ee51254c616187b55e835351705e8cd8 to your computer and use it in GitHub Desktop.
Deletes all completed jobs from all namespaces in a Kubernetes cluster
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for NAMESPACE in $(kubectl get namespaces -o jsonpath='{.items[*].metadata.name}'); do | |
kubectl -n $NAMESPACE delete job $(kubectl -n $NAMESPACE get jobs -o jsonpath='{.items[?(@.status.completionTime)].metadata.name}') | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment