A workload is an application that will run to completion. It can be composed by one or multiple Pods that, loosely or tightly coupled, that, as a whole, complete a task. A workload is the unit of admission in Kueue.
The prototypical workload can be represented with a
Kubernetes batch/v1.Job
.
For this reason, we sometimes use the word job to refer to any workload, and
Job when we refer specifically to the Kubernetes API.
However, Kueue does not directly manipulate Job objects. Instead, Kueue manages Workload objects that represent the resource requirements of an arbitrary workload. Kueue automatically creates a Workload for each Job object and syncs the decisions and statuses.
The manifest for a Workload looks like the following:
apiVersion: kueue.x-k8s.io/v1alpha1
kind: Workload
metadata:
name: sample-job
namespace: default
spec:
podSets:
- count: 3
name: main
spec:
containers:
- image: gcr.io/k8s-staging-perf-tests/sleep:latest
imagePullPolicy: Always
name: container
resources:
requests:
cpu: "1"
memory: 200Mi
restartPolicy: Never
queueName: user-queue
A Workload might be composed of multiple Pods with different pod specs.
Each item of the .spec.pods
list represents a set of homogeneous Pods and has
the following fields:
spec
describes the pods using av1/core.PodSpec
.count
is the number of pods that use the samespec
.name
is a human-readable identifier for the pod set. You can use the role of the Pods in the workload, likedriver
,worker
,parameter-server
, etc.
Workloads have a priority that influences the order in which they are admitted by a ClusterQueue.
You can see the priority of the Workload in the field .spec.priority
.
For a batch/v1.Job
, Kueue sets the priority of the Workload based on the
pod priority
of the Job's pod template.
As described previously, Kueue has built-in support for workloads created with the Job API. But any custom workload API can integrate with Kueue by creating a corresponding Workload object for it.