# How to Suspend All Kubernetes CronJobs

## 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

1. Export Kubeconfig.
2. Retrieve a list of all CronJobs across all namespaces and patch their spec.

{% tabs %}
{% tab title="Bash" %}

```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}{"<br>"}{end}')
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://platform9.com/kb/pmk/how-to/how-to-suspend-all-kubernetes-cronjobs.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
