Troubleshooting delete ClusterQueue
Deleting a ClusterQueue might require additional steps when it has active Workloads.
This guide provides a clear approach to safely deleting a ClusterQueue, explaining the process and offering alternative methods to handle specific scenarios.
For this example, assume your ClusterQueue is named my-cq
.
Understanding kubectl delete clusterqueue
When you run the following command:
you are initiating the deletion of the ClusterQueue object. However, if there are Workloads still utilizing the ClusterQueue, the command may hang or take some time to complete.
Why does this happen?
Kueue creates a Workload object for each Job to track its admission status.
If a Workload is admitted, it is associated with a specific ClusterQueue.
Kueue uses a finalizer
called kueue.x-k8s.io/resource-in-use
to prevent deletion of the ClusterQueue while resources are still in use.
Consequently, a ClusterQueue with this finalizer cannot be deleted until all resources are released.
How to identify the Workloads related to the ClusterQueue?
To find Workloads linked to a specific ClusterQueue, you can use the following steps:
Using kueuectl
Example output:
Using kubectl
and grep
Alternatively, you can use kubectl
with grep
:
Example output:
Note
The grep command only filters lines based on the specified pattern. It might return additional Workloads if the Workload name or LocalQueue name includes the same name as the ClusterQueue.How to stop the ClusterQueue?
Note
If no Workloads are found for the specified ClusterQueue, you can skip the stopping step and proceed directly to deleting the ClusterQueue.
Using kueuectl
To stop all the jobs in a ClusterQueue and prevent new jobs from being admitted by it, run the following command:
Using kubectl edit
Alternatively, you can stop the ClusterQueue by editing its configuration:
In the editor, change the stopPolicy
value to HoldAndDrain
:
Save the changes. This will stop all workloads associated with the ClusterQueue.
How to delete the ClusterQueue?
Once the Workloads are stopped, you can delete the ClusterQueue:
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.