When resources in a cluster become insufficient, high-priority tasks may fail to run. After you enable preemption, ACK Scheduler can determine and evict low-priority pods through resource simulation, releasing computing resources to launch high-priority pods.
Preemption policies
The following list describes the procedure of preemption:
Specify the task priority: Add the
priorityClassNameparameter to the pod configurations to declare the priority of the pod.System components (such as kube-proxy and etcd) are typically associated with the
system-node-criticalPriorityClass, which assigns a high priority. Most system components are deployed as DaemonSets, which are not evicted by default.Simulate preemption when resources become insufficient: When detecting a pending task that fails to be scheduled due to insufficient resources, ACK Scheduler simulates whether certain low-priority tasks can be shut down to release sufficient resources for high-priority tasks.
Securely evict low-priority tasks: After ACK Scheduler triggers the preemption logic, the kubelet evicts low-priority pods from the node in a secure manner according to system instructions, releasing sufficient resources to complete the scheduling of high-priority tasks.
Reschedule low-priority tasks: Evicted low-priority pods will be recreated by the their controllers, such as Deployments, and scheduled to other nodes. If resources in the cluster are still insufficient, the pods remain pending.
ACK Scheduler supports the following preemption policies by default. You can manage and configure them by using the PreemptionAlgorithm parameter.
Policy | Description |
Default | The default preemption policy of Kubernetes. When this policy is used, ACK Scheduler first attempts direct scheduling. When resources are insufficient, ACK Scheduler simulates resource preemption to determine the low-priority pods to evict in order to release sufficient resources for scheduling high-priority pods. For more information, see Pod priority and preemption. |
ElasticQuota | Performs preemption based on the ElasticQuotaTree.
|
Auto | Adjusts the preemption policy based on cluster configurations. Simply put, ACK Scheduler prioritizes the ElasticQuota policy and automatically changes to the Default policy when the ElasticQuota policy does not take effect. |
None | Disables the preemption capability. In this case, no preemption behavior occurs in the cluster. |
When the preemption capability is enabled, the preemption policy takes effect according to the logic described in the following figure.
Enable preemption
Before you enable preemption, we recommend that you read Pod priority and preemption to understand the related terms.
You can customize scheduler parameters by configuring the preemptionAlgorithm parameter to enable preemption. The default preemption policy is Auto.