Red Hat published a walkthrough for scheduling Spark jobs through Kueue on Red Hat OpenShift AI, giving data engineering teams predictable CPU and memory quotas instead of a race for pods. The post, written by Vedant Deshpande, explains the handoff between Kueue and the Kubeflow Spark operator, and covers operational decisions the reference documentation leaves open.
How the admission flow works
Kueue does not replace the Kubernetes scheduler or the Spark operator. Each controller keeps a distinct job. When a user creates a SparkApplication with a local-queue label, Kueue's webhook sets the suspend flag to true and creates a Workload, a custom resource representing the app's resource request inside Kueue's quota engine. Kueue compares that Workload's declared requests with the ClusterQueue quota. If the quota fits, Kueue admits the Workload, clears the suspend flag, and the Spark operator creates driver and executor pods. When the application finishes, Kueue releases the quota and admits the next Workload.
Two surprises follow from this design. A pending SparkApplication is not broken, it may simply be waiting for a quota. And Kubernetes node capacity and Kueue quota are separate constraints, so if a Spark application will not start, the Kueue Workload conditions should be checked before pod events.
The exercise builds a self-managed queue for a project named spark-team-a. The ClusterQueue reserves 3 CPUs and 4 GiB. The sample app requests a driver and 2 executors, 1 CPU and 512m each. One application fits, and a second copy waits until the first finishes. Red Hat recommends self-managed queues because they make quota boundaries explicit and work well with GitOps. OpenShift AI can auto-create queues, but explicit ClusterQueue and LocalQueue resources give administrators tighter control and make code review straightforward.
Setup steps and the label that matters
The condensed path starts with installing the Red Hat build of the Kueue operator from OperatorHub in the Red Hat OpenShift web console, and enabling cluster monitoring for the openshift-kueue-operator namespace. Next, patch the DataScienceCluster to set the Spark operator to Managed and Kueue to Unmanaged. Red Hat warns not to set Kueue to Managed in the DataScienceCluster, since that refers to the deprecated embedded distribution and conflicts with the external operator.
Then add SparkApplication to the Kueue frameworks list by editing the Kueue custom resource, and apply the RBAC that lets Kueue manage SparkApplication finalizers. If a SparkApplication stays suspended with no Workload created, the Kueue controller logs will show blockOwnerDeletion errors, which means the RBAC is missing.
Create the project and label the namespace with kueue.openshift.io/managed=true and a team label. Then create a ResourceFlavor, a ClusterQueue with 3 CPU and 4 GiB, and a LocalQueue. The ClusterQueue uses a namespaceSelector matching the team label. Submitting a SparkApplication requires only one change from a standard manifest: a label with the queue name. A second copy submitted while the first runs stays suspended and queued, then starts automatically when the first completes.
What the reference docs leave out
Three subtleties are easy to miss. Preemption is a restart, not a pause. When Kueue suspends a running SparkApplication, the Spark operator deletes every driver and executor pod. In-memory state, shuffle data, and ephemeral files are gone, and Kueue does not checkpoint the application. Red Hat advises starting with non-preemptive quotas unless workloads handle restarts gracefully, and requiring persistent output, idempotent transformations, and checkpoints stored outside the pods if preemption is enabled later.
Dynamic executor allocation is not supported with Kueue, so executor.instances must be set to a fixed value. An unlabeled SparkApplication can bypass the queue: the namespace label activates Kueue webhooks, but the app still needs the queue-name label. And quota is not utilization. Kueue reserves quota based on declared requests, not runtime consumption, so a driver requesting 1 CPU but idling at 100m still holds 1 CPU of quota. Red Hat requires explicit coreRequest values for both driver and executors in every manifest, since missing requests can throw off the quota math for everyone.
Before onboarding more teams, Red Hat suggests an operating policy that answers four questions: who owns each quota, what the declared footprint is, when preemption is acceptable based on restart cost rather than priority labels, and how users identify a healthy wait by publishing the commands to inspect Workloads. The configuration surface is small: one Kueue custom resource update, one RBAC manifest, and one label per SparkApplication. Testing the setup means submitting two copies of the same application and confirming the second waits without creating pods, then starts when the first finishes.
Sources & references
Red Hat: How Kueue schedules Spark jobs fairly on Red Hat OpenShift AI ↗Source consulted: 2026-11-11



