Pod PriorityClass in Kubernetes comes with several properties that define its behavior and impact on workload scheduling. Let’s explore these properties in detail:

Here is an example of a PriorityClass manifest with all the properties:

YAML
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
  name: high-priority
  annotations:
    priority.preemptionPolicy: PreemptLowerPriority
    description: "This is a high priority class for critical workloads."
spec:
  value: 1000000
  globalDefault: false

1. Name

  • Name: This property specifies the name of the PriorityClass. Names must be unique within the Kubernetes cluster.
YAML
metadata:
  name: high-priority

2. Value

  • Value: Represents the numeric value of the priority. Higher values indicate higher priority. The default value is 0.
YAML
value: 1000000

3. Global Default

  • GlobalDefault: Determines whether the PriorityClass is the default for all pods that do not have a PriorityClass explicitly set. It’s a boolean property, with the default value set to false.
YAML
globalDefault: false

4. Description

  • Description: Provides a description of the PriorityClass, explaining its purpose or significance.
YAML
description: "This is a high priority class for critical workloads."

5. Preemption Policy

  • PreemptionPolicy: Specifies the preemption policy for pods using this PriorityClass. It determines whether and how lower-priority pods can be preempted to make room for higher-priority ones. The available options are:
    • PreemptLowerPriority: Kubernetes will preempt lower priority pods if necessary to schedule higher priority ones.
    • Never: Kubernetes will never preempt pods using this PriorityClass.
    • PreemptEverything: Kubernetes will preempt any pod to make room for pods using this PriorityClass.
YAML
preemptionPolicy: PreemptLowerPriority

These properties collectively define the behavior of a PriorityClass in Kubernetes, influencing how pods are scheduled and prioritized within the cluster. By configuring these properties appropriately, you can ensure that critical workloads receive the necessary resources and priority, contributing to the overall stability and performance of your Kubernetes environment.

By |Last Updated: May 5th, 2024|Categories: Kubernetes|

Table of Contents