Kubernetes "no PriorityClass with name" - Fix priorityClassName in CI
A pod (or its controller’s template) names a priorityClassName that does not exist in the cluster. The API server rejects the pod at admission because the referenced PriorityClass must be created first.
What this error means
Applying a Deployment/pod fails, or the controller cannot create pods, with no PriorityClass with name "<name>" was found. It is deterministic - the class is genuinely not installed in this cluster.
Error creating: pods "api-..." is forbidden: no PriorityClass with name
"high-priority" was foundCommon causes
The PriorityClass was never created
PriorityClasses are cluster-scoped objects that must be applied before any pod references them. A manifest that names one that was not installed is rejected.
Wrong cluster or environment
A class that exists in staging may not exist in the target cluster. CI pointed at a cluster without that class fails even though the same manifest works elsewhere.
How to fix it
Create the PriorityClass before the workloads
Apply the cluster-scoped PriorityClass as an ordered step ahead of the Deployments that use it.
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
name: high-priority
value: 1000000
globalDefault: false
description: "Critical workloads"Confirm what exists and reference it exactly
kubectl get priorityclasses
# then set spec.template.spec.priorityClassName to an existing nameHow to prevent it
- Apply cluster-scoped PriorityClasses before the workloads that reference them.
- Keep PriorityClass names consistent across environments.
- Validate
priorityClassNameagainstkubectl get priorityclassesin CI pre-flight.