Red Hat turns Spark submission races into explicit Kueue quotas
A new OpenShift AI walkthrough shows how to admit whole Spark applications before their driver and executor pods consume cluster capacity.
Red Hat has published a practical pattern for putting Spark applications behind Kueue admission control on OpenShift AI, replacing a race for individual pods with an inspectable queue and declared CPU and memory quotas.
The walkthrough separates three responsibilities. Kueue decides whether an application’s requested resources fit within quota, the Kubeflow Spark Operator creates driver and executor pods after admission, and the Kubernetes scheduler places those pods on nodes.
How the admission path works
When a user submits a labeled SparkApplication, Kueue’s webhook suspends it and creates a Workload representing its resource request. Kueue compares that request with a ClusterQueue. If quota is available, it admits the workload and removes the suspension; only then does the Spark Operator create the driver and executors. When the application finishes, the quota is released for the next workload.
That sequencing changes the meaning of “pending.” A Spark application may be waiting normally for quota rather than failing to schedule. Red Hat recommends checking Kueue workload conditions before diagnosing pod events, because Kueue quota and Kubernetes node capacity are separate constraints.
The example creates a self-managed queue for one project with three CPUs and 4 GiB of memory. A sample driver plus two executors consumes the available CPU quota, so a second copy waits without creating pods until the first completes.
The configuration choices that matter
The article installs the external Red Hat build of Kueue operator, keeps the OpenShift AI DataScienceCluster Kueue component unmanaged, and enables the managed Spark Operator. It warns that setting Kueue to managed there selects a deprecated embedded distribution that conflicts with the external operator.
Administrators must also add SparkApplication to Kueue’s integration frameworks and grant RBAC for finalizer management. A missing permission can leave an application suspended without a corresponding workload; the walkthrough points to blockOwnerDeletion errors in the Kueue controller log as the diagnostic signal.
Red Hat favors explicit ResourceFlavor, ClusterQueue and LocalQueue resources over auto-created queues because their quota boundaries can be reviewed through GitOps. Each Spark application still needs a kueue.x-k8s.io/queue-name label: labeling the namespace as managed does not stop an unlabeled application from bypassing the queue.
Operational limits
Preemption is the sharp edge. Suspending a running Spark application deletes its driver and executor pods; Kueue does not checkpoint it. The article recommends starting with non-preemptive quotas unless jobs use persistent output, idempotent transformations and external checkpoints.
Dynamic executor allocation is not supported in this setup, so teams must use a fixed executor count. Quota is charged from declared requests rather than observed utilization, which makes explicit driver and executor requests part of the platform contract.
The smallest useful test is two identical applications: the first should run, the second should remain queued without pods, and the second should start automatically after the first releases quota. That verifies the admission path before platform teams apply it to production Spark workloads.
sources
- How Kueue schedules Spark jobs fairly on Red Hat OpenShift AIdevelopers.redhat.com
comments · 0