<p>In Kubernetes we can set the priority of a pod to <code>Guaranteed</code>, <code>Burstable</code> or <code>Best-Effort</code> base on requests and limits. Another method to assign priorities in Kubernetes is to define a <code>priorityClass</code> object and assign a <code>priorityClassName</code> to a pod. How are these methods different and when we have to choose one method over another? According to <a href="https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/#interactions-of-pod-priority-and-qos" rel="noreferrer">https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/#interactions-of-pod-priority-and-qos</a>:</p>

<blockquote>
  <p>The scheduler’s preemption logic does not consider QoS when choosing preemption targets. Preemption considers Pod priority and attempts to choose a set of targets with the lowest priority.</p>
</blockquote>

<p>So if the Kubernetes has to choose between a pod with <code>Guaranteed</code> QoS which has a lower "priorityClass"  Value than a <code>Burstable</code> pod, does it put the <code>Guaranteed</code> pod in Preempting state?</p>

<p><code>Quality of Service</code> determines scheduling and eviction priority of pods. When a pod is not given any resources requests/ limits it is considered as <code>low-priority pod (best effort)</code>. If node is out of resources it is the first pod to be evicted. </p>

<p><code>Medium priority (burstable)</code> when a pod has any resource/limits specified (does not meet guaranteed class requirements). </p>

<p><code>Highest priority (guaranteed)</code> when a pod has requests and limits set to the same value (both CPU and memory).</p>

<p><code>PriorityClass</code> is used to determine pod priority when it comes to eviction. Sometimes you may want one pod to be evicted before another pod. Priority is described by integer in it's <code>value</code> field and the higher the value, the higher the priority. </p>

<p>When Pod priority is enabled, the scheduler orders pending Pods by their priority and a pending Pod is placed ahead of other pending Pods with lower priority in the scheduling queue. If there are no nodes with resources to satisfy high-priority node it will evict pods with lower priority. The highest priority is <code>system-node-critical</code>.</p>

<ul>
<li><code>QoS</code> is used to control and manage resources on the node among the
pods. QoS eviction happens when there are no available resources on
the node.</li>
<li>The scheduler considers the <code>PriorityClass</code> of the Pod before the QoS. It does not attempt to evict Pods unless higher-priority Pods need to be scheduled and the node does not have enough room for them.</li>
<li><code>PriorityClass</code>- when pods are preempted, <code>PriorityClass</code> respects graceful termination period but does not guarantee pod disruption budget to be honored. </li>
</ul>
