How to Suspend All Kubernetes CronJobs
PreviousHow to Drain A Kubernetes Node Using APINextHow-To Query Container Mounts Using Crictl or Nerdctl
Last updated
CronJobs running on the cluster need to be (temporarily) suspended (such as for a maintenance activity).
Platform9 Managed Kubernetes - All Versions
kubectl
Export Kubeconfig.
Retrieve a list of all CronJobs across all namespaces and patch their spec.
while read -r CRONJOB NAMESPACE; do kubectl -n $NAMESPACE patch cronjobs -p '{"spec" : {"suspend" : true }}' $CRONJOB; done <<< $(kubectl get cronjobs -Ao=jsonpath='{range .items[*]}{@.metadata.name}{" "}{@.metadata.namespace}{"<br>"}{end}')Last updated
