Managed Kubernetes
Latest
Frequently Asked Questions
Solutions
How Tos
Internal Only
Templates
Powered By

Title
Message
Create new category
What is the title of your new category?
Edit page index title
What is the title of the page index?
Edit category
What is the new title of your category?
Edit link
What is the new title and URL of your link?
How to Suspend All Kubernetes CronJobs
Copy Markdown
Open in ChatGPT
Open in Claude
Problem
CronJobs running on the cluster need to be (temporarily) suspended (such as for a maintenance activity).
Environment
- Platform9 Managed Kubernetes - All Versions
- kubectl
Procedure
- Export Kubeconfig.
- Retrieve a list of all CronJobs across all namespaces and patch their spec.
Bash
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}{"\n"}{end}')VariableType to search · ESC to discard
GlossaryType to search · ESC to discard
InsertType to search · ESC to discard
No matches
Last updated on
Was this page helpful?
Next to read:
How-To Query Container Mounts Using Crictl or NerdctlDiscard Changes
Do you want to discard your current changes and overwrite with the template?
Archive Synced Block
Message
Create new Template
What is this template's title?
Delete Template
Message