|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * /configure/configuring-quotas.adoc |
| 4 | + |
| 5 | +:_mod-docs-content-type: PROCEDURE |
| 6 | +[id="configuring-clusterqueues_{context}"] |
| 7 | += Configuring a cluster queue |
| 8 | + |
| 9 | +A cluster queue is a cluster-scoped resource, represented by a `ClusterQueue` object, that governs a pool of resources such as CPU, memory, and pods. |
| 10 | +Cluster queues can be used to define usage limits, quotas for resource flavors, order of consumption, and fair sharing rules. |
| 11 | + |
| 12 | +[NOTE] |
| 13 | +==== |
| 14 | +The cluster queue is not ready for use until a `ResourceFlavor` object has also been configured. |
| 15 | +==== |
| 16 | + |
| 17 | +.Prerequisites |
| 18 | + |
| 19 | +include::snippets/prereqs-snippet.adoc[] |
| 20 | + |
| 21 | +.Procedure |
| 22 | + |
| 23 | +. Create a `ClusterQueue` object as a YAML file: |
| 24 | ++ |
| 25 | +.Example of a basic `ClusterQueue` object using a single resource flavor |
| 26 | +[source,yaml] |
| 27 | +---- |
| 28 | +apiVersion: kueue.x-k8s.io/v1beta1 |
| 29 | +kind: ClusterQueue |
| 30 | +metadata: |
| 31 | + name: example-queue |
| 32 | +spec: |
| 33 | + namespaceSelector: {} <1> |
| 34 | + resourceGroups: |
| 35 | + - coveredResources: ["cpu", "memory", "pods", "foo.com/gpu"] <2> |
| 36 | + flavors: |
| 37 | + - name: "default-flavor" <3> |
| 38 | + resources: <4> |
| 39 | + - name: "cpu" |
| 40 | + nominalQuota: 9 |
| 41 | + - name: "memory" |
| 42 | + nominalQuota: 36Gi |
| 43 | + - name: "pods" |
| 44 | + nominalQuota: 5 |
| 45 | + - name: "foo.com/gpu" |
| 46 | + nominalQuota: 100 |
| 47 | +---- |
| 48 | +<1> Defines which namespaces can use the resources governed by this cluster queue. An empty `namespaceSelector` as shown in the example means that all namespaces can use these resources. |
| 49 | +<2> Defines the resource types governed by the cluster queue. This example `ClusterQueue` object governs CPU, memory, pod, and GPU resources. |
| 50 | +<3> Defines the resource flavor that is applied to the resource types listed. In this example, the `default-flavor` resource flavor is applied to CPU, memory, pod, and GPU resources. |
| 51 | +<4> Defines the resource requirements for admitting jobs. This example cluster queue only admits jobs if the following conditions are met: |
| 52 | ++ |
| 53 | +* The sum of the CPU requests is less than or equal to 9. |
| 54 | +* The sum of the memory requests is less than or equal to 36Gi. |
| 55 | +* The total number of pods is less than or equal to 5. |
| 56 | +* The sum of the GPU requests is less than or equal to 100. |
| 57 | + |
| 58 | +. Apply the `ClusterQueue` object by running the following command: |
| 59 | ++ |
| 60 | +[source,terminal] |
| 61 | +---- |
| 62 | +$ oc apply -f <filename>.yaml |
| 63 | +---- |
0 commit comments