Kubernetes
Kubernetes PriorityClass Cleanup: Remove Scheduling Rules That No Longer Fit
Kubernetes PriorityClass cleanup starts when old scheduling priorities continue to influence pod placement, preemption, and quota decisions after workloads, SLOs, or cluster architecture changed. A stale priority can make ordinary jobs too powerful, keep critical services under-protected, or cause confusing evictions during pressure.
The useful outcome is a scheduling cleanup plan that maps each PriorityClass to current workloads, preemption risk, namespace policy, and replacement behavior. This is cluster reliability work, not cosmetic YAML cleanup.
Key takeaways
- Inventory PriorityClasses with pods, controllers, namespaces, and quota rules that reference them.
- Check whether preemption is enabled and whether lower-priority workloads have been evicted.
- Treat batch, platform, and customer-facing workloads differently.
- Stage changes by updating workload specs before deleting the class.
- Prevent recurrence by requiring criticality definitions for new priorities.
Evidence to Collect
| Check | What to look for | Cleanup signal |
|---|---|---|
| Pod references | Deployments, Jobs, CronJobs, StatefulSets, DaemonSets | No active controller uses the class |
| Preemption behavior | Events, pending pods, evictions, disruption budgets | Priority causes unwanted scheduling pressure |
| Namespace policy | ResourceQuota scopes, admission rules, team ownership | Class is outside approved workload tier |
| Replacement tier | SLO, support level, maintenance window | Workload maps to an existing priority |
Use cluster events and controller specs together. A class might be unused now but still referenced in a paused CronJob or rollout template.
Read-Only Review
kubectl get priorityclass
kubectl get pods --all-namespaces \
-o custom-columns=NAMESPACE:.metadata.namespace,NAME:.metadata.name,PRIORITY:.spec.priorityClassName
kubectl get events --all-namespaces --field-selector reason=Preempted
These commands show references and recent preemption evidence. They do not prove deletion safety until controllers, quotas, and admission policy are reviewed.
Cleanup Path
First, define the intended priority tiers in plain language. Then update workloads to supported classes, starting with non-critical namespaces. Watch pending pods, evictions, and disruption budget behavior. After no controllers reference the stale class, remove admission exceptions, docs, dashboards, and finally the PriorityClass.
Do not rush priorities for cluster agents, ingress controllers, storage drivers, or incident response tools. Do not rush cleanup during capacity shortages, because scheduling behavior changes are harder to interpret when the cluster is already under pressure.
Prevention
Require every new PriorityClass to include a tier name, owner, allowed namespaces, preemption expectation, and review date. Admission policy should make unusual priority usage explicit instead of letting teams copy a powerful class into ordinary workloads.
FAQ
Is an unused PriorityClass harmful?
It can be. The object itself is small, but stale classes invite copy-paste scheduling decisions nobody understands.
Can we merge several priorities into one?
Yes, if the workloads have the same criticality and preemption expectations. Do not merge just because names look similar.