Create and Assign a Custom PriorityClass to a Workload
Scenario
Your cluster has several PriorityClasses defined for different tiers of workloads.
A new production service prod-event-collector needs to be
assigned a priority just below the highest existing user-defined tier —
high enough to be preferred over general workloads, but not competing
with the most critical platform services.
Task
- List the existing PriorityClasses and find the highest user-defined
value. Ignore system classes (values above
1000000000). - Create a new PriorityClass named
prod-high-prioritywith a value exactly one less than the highest user-defined value found. SetglobalDefault: false. - Patch the deployment
prod-event-collectorin theprod-platformnamespace to useprod-high-priorityas itspriorityClassName.
Hint 1 — List and Compare Existing PriorityClasses
List all PriorityClasses on the cluster and inspect their values:
kubectl get priorityclass
Kubernetes ships with two built-in system classes — system-cluster-critical
and system-node-critical — with values above 1000000000. Ignore those.
Your target is the highest user-defined value (below 1000000000).
Documentation
Hint 2 — Create the PriorityClass
A PriorityClass is a cluster-scoped resource. The key fields to set are
value, globalDefault, and optionally description. Note that value
and globalDefault are top-level fields — not nested under metadata
or spec.
Use kubectl apply -f with a manifest, or kubectl create priorityclass
if you prefer the imperative path. Refer to the docs for the exact schema.
Documentation
Hint 3 — Patch the Deployment
priorityClassName is a field under spec.template.spec in a Deployment.
You can update it using kubectl patch --type=merge, kubectl edit, or
kubectl set — whichever you're comfortable with. The field accepts the
name of any existing PriorityClass on the cluster.
After updating, wait for the rollout to complete before verifying.
Documentation