Kubernetes: Pod Priority

Pod priority is a new resource in Kubernetes that allow you to interfere with how pods are scheduled. It was added back in v1.8 and is currently in the beta phase of kubernetes version 1.11. The idea of pod priority is simple. It allows us to basically give preferential treatment to specified or selected applications. The selection is made by the cluster administrator

For example, if compute resources are exhausted in the cluster and the pod assigned a high priority needs to be scheduled, the scheduler will evict pods from the cluster to accommodate the application with highest priority.Pod priority affects the scheduling order of pods in the cluster based on how priority is set. Pods are either preempted or evicted by the scheduler when making priority decisions.

When a pod is giving a priority higher than that of other pods in the cluster, the scheduler makes sure that at all times when that pods needs to be scheduled it will always be first on the scheduling queue regardless of other pods pending prior to its creation.

To assign pod priority, a priority class object needs to be created and then referenced in the podspec of the pod that needs to be assigned a priority. Here is a sample on how to create a pod priority class object:

Kind: PriorityClass
apiVersion: scheduling.k8s.io/v1alpha1
  name: high-priority-app
value: 999999
globalDefault: false
description: "priority for critical apps"

next we create the pod that uses the priority class object

apiVersion: v1
kind: Pod
  name: pod-example
  - name: nginx
    image: nginx
  PriorityClassName: high-priority-app

One thought on “Kubernetes: Pod Priority”

  1. Hi,I log on to your blog named “Kubernetes: Pod Priority – Babatunde Olu’s Blog!” regularly.Your story-telling style is awesome, keep it up! And you can look our website about proxy.

Leave a Reply

Your email address will not be published. Required fields are marked *