1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/kueue-monitoring-pending-workloads-on-demand.adoc
2025-12-16 17:21:21 +00:00

106 lines
2.7 KiB
Plaintext

// Module included in the following assemblies:
//
// * ai_workloads/kueue/monitoring-pending-workloads.adoc
:_mod-docs-content-type: PROCEDURE
[id="monitoring-pending-workloads-on-demand_{context}"]
= Monitoring pending workloads on demand
[role="_abstract"]
To test the monitoring of pending workloads, you must correctly configure both the `ClusterQueue` and the `LocalQueue` resources. After that, you can create jobs on that `LocalQueue`. Kueue manages the workload object created from the job so, when a job is submitted and saturates the `ClusterQueue`, its corresponding workloads can be seen in the list of pending workloads.
.Prerequisites
* You have cluster administrator permissions.
* The {kueue-name} Operator is installed on your cluster, and you have created a `Kueue` custom resource (CR).
* You have installed the {oc-first}.
* The {oc-first} has communication with your cluster.
The following procedure tells you how to install and test workload monitoring.
.Procedure
. Create the assets by running the following command:
+
[source,terminal]
----
cat <<EOF| oc create -f -
---
apiVersion: kueue.x-k8s.io/v1beta1
kind: ResourceFlavor
metadata:
name: "default-flavor"
---
apiVersion: kueue.x-k8s.io/v1beta1
kind: ClusterQueue
metadata:
name: "cluster-queue"
spec:
namespaceSelector: {} # match all.
resourceGroups:
- coveredResources: ["cpu", "memory"]
flavors:
- name: "default-flavor"
resources:
- name: "cpu"
nominalQuota: 9
- name: "memory"
nominalQuota: 36Gi
---
apiVersion: kueue.x-k8s.io/v1beta1
kind: LocalQueue
metadata:
namespace: "default"
name: "user-queue"
spec:
clusterQueue: "cluster-queue"
---
EOF
----
. Create the following file with the job manifest:
+
[source,terminal]
----
cat >> job.yaml << EOF
apiVersion: batch/v1
kind: Job
metadata:
generateName: sample-job-
namespace: default
labels:
kueue.x-k8s.io/queue-name: user-queue
spec:
parallelism: 3
completions: 3
suspend: true
template:
spec:
containers:
- name: <example-job>
image: registry.k8s.io/e2e-test-images/agnhost:2.53
command: [ "/bin/sh" ]
args: [ "-c", "sleep 60" ]
resources:
requests:
cpu: "1"
memory: "200Mi"
restartPolicy: Never
EOF
----
. Label the default namespace to be managed by Kueue by running the following command:
+
[source,terminal]
----
$ oc label namespace default kueue.openshift.io/managed=true
----
. Create the six jobs by running the following command:
+
[source,terminal]
----
for i in {1..6}; do oc create -f job.yaml; done
----
+
In this example, three of the jobs saturate the `ClusterQueue` resource and the other three jobs should be pending.