How to set pod priority for AI agent workloads in Kubernetes

Give each AI agent pod a PriorityClass, then set its priorityClassName in the pod template. The scheduler orders pending pods by priority. A pending pod that fits on no node can evict lower-priority pods to make room, so give agents a priority that matches how much they matter, and no higher.
Based on the Kubernetes v1.37 documentation as fetched on 2026-11-21. No cluster test was run for this post.
How the scheduler uses priority
Pods can have priority, which shows how important a pod is relative to other pods. When a pod cannot be scheduled, the scheduler tries to preempt, or evict, lower-priority pods so the pending pod can fit. Priority is therefore the tool for deciding which pod waits when the cluster is full.
When a pod is created, the priority admission controller reads priorityClassName and fills in the integer value. If the named class does not exist, the pod is rejected. The class therefore has to exist before the agent’s pods are created.
Preemption starts only when no node satisfies the pending pod. The scheduler looks for a node where removing lower-priority pods would let the pending pod fit. It removes only as many as it needs. A node is a candidate only if removing all of its lower-priority pods would make room. Pods of equal priority are never victims, because preemption requires a pending pod with higher priority.
Create the PriorityClass
A PriorityClass is a cluster-scoped object that maps a name to an integer. The fields that matter for agents are below.
| Field | Required | What the docs say |
|---|---|---|
value |
Yes | A 32-bit integer up to 1000000000. Larger values are reserved for built-in critical classes |
globalDefault |
No | When true, pods without a priorityClassName use this value. Only one class may set it |
description |
No | Free text that tells users when to use the class |
preemptionPolicy |
No | PreemptLowerPriority by default. Never makes the class non-preempting |
Work through these steps for each agent tier:
- Choose a name. It must be a valid DNS subdomain name, and it cannot start with
system-. - Choose a value. A higher number means a higher priority. Keep agent classes at or below 1000000000. The pod priority docs say the built-in classes are
system-cluster-criticalat 2000000000 andsystem-node-criticalat 2000001000 in v1.37. - Decide on
globalDefault. Set it on at most one class. If no class sets it, pods without apriorityClassNamehave priority zero.
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
name: agent-standard
value: 100000
globalDefault: false
description: "Interactive coding agents in the agents namespace."
Use preemptionPolicy for batch agents
Not every agent should evict other pods. The preemptionPolicy field decides whether a class may preempt at all. The default allows it, and Never turns it off.
| Setting | Can evict lower-priority pods | Position in the queue | Can be preempted by a higher-priority pod |
|---|---|---|---|
PreemptLowerPriority (default) |
Yes | Ahead of lower-priority pending pods | Yes |
Never |
No | Ahead of lower-priority pending pods | Yes |
A Never pod waits in the queue until resources free up on their own. It is still subject to scheduler back-off, so the scheduler retries it less often, and lower-priority pods can get room first. The docs’ use case is a job that should jump the queue without discarding running work, which describes a batch agent run well.
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
name: agent-batch-nonpreempting
value: 50000
preemptionPolicy: Never
globalDefault: false
description: "Batch agent Jobs that wait for free capacity and never evict running pods."
Set the priority on the agent pods
Add priorityClassName to the pod spec. The docs use a plain Pod for the example. For a workload, the docs say you normally add the field to the Pod template of a collection object such as a Deployment, so the value follows every replica.
apiVersion: v1
kind: Pod
metadata:
name: agent-worker
labels:
app: agent-worker
spec:
containers:
- name: agent
image: registry.example.com/agent-worker:1.4.0
imagePullPolicy: IfNotPresent
priorityClassName: agent-standard
Once a preemption starts, check the pod’s status. The scheduler sets nominatedNodeName on the preempting pod to the node it reserved.
Decide which agent pods should preempt
Preemption is useful for an interactive agent that a person is waiting on. It is a poor fit for a long batch run that can resume later. Use this checklist before you assign a class:
- Give the highest classes only to agents whose delay costs more than the work they would displace.
- Keep untrusted or user-supplied agents in a low class.
- Put batch agents on
Neverso they queue instead of evicting. - Review the events on any pod that gets preempted, since the docs say events are recorded for victims.
Preemption should happen only when the cluster lacks room for a pending pod and that pod has higher priority than the victims. When several nodes can take the pod, the scheduler prefers the node whose pods have the lowest priority. If a pod gets preempted by mistake, check its priorityClassName, which the docs say you can change or leave empty to resolve to zero.
A PodDisruptionBudget is respected on a best-effort basis during preemption. The scheduler prefers victims whose budget would hold, but it will evict pods that violate their budgets if nothing else fits. QoS class plays no part in the choice. The preemption logic looks only at priority, so the QoS class of a pod does not change which pods are chosen.
Limit who can claim high priority
Priority is only safe when users cannot pick any class they like. The docs note that an administrator can use ResourceQuota to prevent users from creating pods at high priorities.
A ResourceQuota with a PriorityClass scope matches only pods in that class. It can track pods, cpu, memory, ephemeral-storage, and their limits and requests. The example below caps the standard agent class in one namespace. Pods in other classes do not count against it.
apiVersion: v1
kind: ResourceQuota
metadata:
name: pods-agent-standard
namespace: agents
spec:
hard:
cpu: "10"
memory: "20Gi"
pods: "10"
scopeSelector:
matchExpressions:
- operator: In
scopeName: PriorityClass
values: ["agent-standard"]
The resource quota docs also describe a cluster-wide control under “Limiting PriorityClass consumption by default.” An administrator passes an admission configuration to kube-apiserver, and pods in a restricted class are then allowed only in namespaces that have a matching quota object. Pair that with the namespace quota in how to set a ResourceQuota for an AI agent namespace.
Where to go next
Priority decides the scheduling order and which pods get preempted. Resource caps are a separate setting. For those, read how to set resource limits on AI agent pods, and for the pod-level security settings that sit beside them, see Pod Security Admission levels for AI agent workloads.
For the wider policy view of governing agents, start with the governing AI agents hub. For Nirmata’s own product in this area, see the AIControls platform page.
Frequently asked questions
Does a PriorityClass change the order in which pending agent pods are scheduled?
Yes. The scheduler orders pending pods by priority, so a higher-priority pending pod is placed ahead of lower-priority pods in the scheduling queue. If the higher-priority pod can be scheduled, it may start sooner. If it cannot, the scheduler keeps going and tries the lower-priority pods. A pod with no priorityClassName has priority zero unless the cluster has a PriorityClass with globalDefault set to true.
Will preemption stop an agent in the middle of a long task?
It can. Preemption removes running lower-priority pods so a higher-priority pod can be scheduled. Each victim gets its graceful termination period, 30 seconds by default, and is forcibly terminated if it has not exited by then. A Never preemption policy stops an agent from evicting other pods, but it does not protect that agent from a higher-priority pod. Agents that hold state should checkpoint their work.
Does a PodDisruptionBudget protect agent pods from preemption?
Only on a best-effort basis. The scheduler tries to choose victims whose PodDisruptionBudget would not be violated. If no such victims exist, preemption still happens, and lower-priority pods are removed even though their budgets are violated. Quality of service plays no part in choosing victims, so a Guaranteed pod gets no extra protection.
Can a cluster stop a user from giving agent pods a high priority?
Yes. A ResourceQuota with a PriorityClass scope matches only pods in that class, and it can cap their pods, CPU and memory. The admission configuration option that governs restricted classes is set on kube-apiserver, so check how your platform team sets it before you rely on it.