Skip to content

Instantly share code, notes, and snippets.

@marfenij
Created May 15, 2019 08:43
Show Gist options
  • Save marfenij/893082cb023a691e913c28f2cf929707 to your computer and use it in GitHub Desktop.
Save marfenij/893082cb023a691e913c28f2cf929707 to your computer and use it in GitHub Desktop.
Suspend/Resume k8s cronjobs
# suspend active cronjobs
kubectl.exe get cronjob | grep False | awk '{print $1}' | xargs kubectl patch cronjob -p '{"spec" : {"suspend" : true }}'
# resume suspended cronjobs
kubectl.exe get cronjob | grep True | awk '{print $1}' | xargs kubectl patch cronjob -p '{"spec" : {"suspend" : false }}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment