You have a PriorityClass 'high-priority' with value 1000 and 'low-priority' with value 100. A pod A with 'high-priority' is pending because the node has no resources. A pod B with 'low-priority' is running on that node. What will happen if preemption is enabled?
Trap 1: Pod A will be scheduled only after pod B completes its work
This statement is incorrect because Kubernetes' preemption mechanism is specifically designed to prevent higher-priority pods from waiting. Instead of waiting for Pod B to naturally complete its execution and release resources, the kube-scheduler will actively identify Pod B as a candidate for eviction. This ensures that the critical Pod A, with its higher priority, gains immediate access to the necessary node resources without delay, overriding a simple FIFO scheduling approach.
Trap 2: Pod A will remain pending because preemption is not enabled by…
This option is false because preemption is a fundamental and enabled-by-default feature of the Kubernetes kube-scheduler. The scheduler continuously evaluates pending pods and, if a higher-priority pod cannot be scheduled due to resource constraints, it automatically initiates the preemption process. There is no special configuration or manual intervention required to activate this behavior, making the premise of preemption not being enabled by default incorrect.
Trap 3: The cluster administrator must manually delete pod B to allow pod A…
This option is incorrect as it fundamentally misrepresents the automated nature of Kubernetes preemption. The kube-scheduler is specifically designed to handle resource contention by identifying lower-priority pods that occupy resources needed by a higher-priority pod and then automatically triggering their eviction. Manual intervention by a cluster administrator to delete Pod B would bypass this built-in automation, which is designed for efficient and self-managing resource allocation.
- A
Pod A will be scheduled only after pod B completes its work
Why it fails: This statement is incorrect because Kubernetes' preemption mechanism is specifically designed to prevent higher-priority pods from waiting. Instead of waiting for Pod B to naturally complete its execution and release resources, the kube-scheduler will actively identify Pod B as a candidate for eviction. This ensures that the critical Pod A, with its higher priority, gains immediate access to the necessary node resources without delay, overriding a simple FIFO scheduling approach.
- B
Pod A will remain pending because preemption is not enabled by default
Why it fails: This option is false because preemption is a fundamental and enabled-by-default feature of the Kubernetes kube-scheduler. The scheduler continuously evaluates pending pods and, if a higher-priority pod cannot be scheduled due to resource constraints, it automatically initiates the preemption process. There is no special configuration or manual intervention required to activate this behavior, making the premise of preemption not being enabled by default incorrect.
- C
The cluster administrator must manually delete pod B to allow pod A to schedule
Why it fails: This option is incorrect as it fundamentally misrepresents the automated nature of Kubernetes preemption. The kube-scheduler is specifically designed to handle resource contention by identifying lower-priority pods that occupy resources needed by a higher-priority pod and then automatically triggering their eviction. Manual intervention by a cluster administrator to delete Pod B would bypass this built-in automation, which is designed for efficient and self-managing resource allocation.
- D
Pod B will be preempted (evicted) to allow pod A to be scheduled on the node
This is the correct behavior. When Pod A, possessing a higher priority, cannot find a node with sufficient available resources, the kube-scheduler will identify a node where Pod B (a lower-priority pod) is running and whose eviction would free up the necessary resources. The scheduler then initiates the preemption process, which involves evicting Pod B from that node. This action frees up the required resources, allowing Pod A to be successfully scheduled and started on the now-available node.