Last active
December 4, 2024 14:03
Suspending all cronjobs in all namespaces in kubernetes
This file contains hidden or 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
#!/bin/bash | |
for ns in $(kubectl get ns -o jsonpath="{.items[*].metadata.name}"); do | |
for cj in $(kubectl get cronjobs -n "$ns" -o name); do | |
kubectl patch "$cj" -n "$ns" -p '{"spec" : {"suspend" : true }}'; | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice! Thank you